Skip to content

Commit

Permalink
Revert "[CodeGen] Use poison instead of undef as placeholder in Atomi…
Browse files Browse the repository at this point in the history
…cExpandPass [NFC]"

This reverts commit f50423c.
  • Loading branch information
nunoplopes committed Nov 22, 2022
1 parent 878010d commit b50e1bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions llvm/lib/CodeGen/AtomicExpandPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ bool AtomicExpand::expandPartwordCmpXchg(AtomicCmpXchgInst *CI) {
Builder.SetInsertPoint(CI);

Value *FinalOldVal = extractMaskedValue(Builder, OldVal, PMV);
Value *Res = PoisonValue::get(CI->getType());
Value *Res = UndefValue::get(CI->getType());
Res = Builder.CreateInsertValue(Res, FinalOldVal, 0);
Res = Builder.CreateInsertValue(Res, Success, 1);

Expand Down Expand Up @@ -1094,7 +1094,7 @@ void AtomicExpand::expandAtomicCmpXchgToMaskedIntrinsic(AtomicCmpXchgInst *CI) {
Builder, CI, PMV.AlignedAddr, CmpVal_Shifted, NewVal_Shifted, PMV.Mask,
CI->getMergedOrdering());
Value *FinalOldVal = extractMaskedValue(Builder, OldVal, PMV);
Value *Res = PoisonValue::get(CI->getType());
Value *Res = UndefValue::get(CI->getType());
Res = Builder.CreateInsertValue(Res, FinalOldVal, 0);
Value *Success = Builder.CreateICmpEQ(
CmpVal_Shifted, Builder.CreateAnd(OldVal, PMV.Mask), "Success");
Expand Down Expand Up @@ -1186,7 +1186,7 @@ AtomicExpand::convertCmpXchgToIntegerType(AtomicCmpXchgInst *CI) {

OldVal = Builder.CreateIntToPtr(OldVal, CI->getCompareOperand()->getType());

Value *Res = PoisonValue::get(CI->getType());
Value *Res = UndefValue::get(CI->getType());
Res = Builder.CreateInsertValue(Res, OldVal, 0);
Res = Builder.CreateInsertValue(Res, Succ, 1);

Expand Down Expand Up @@ -1430,7 +1430,7 @@ bool AtomicExpand::expandAtomicCmpXchg(AtomicCmpXchgInst *CI) {
// Some use of the full struct return that we don't understand has happened,
// so we've got to reconstruct it properly.
Value *Res;
Res = Builder.CreateInsertValue(PoisonValue::get(CI->getType()), Loaded, 0);
Res = Builder.CreateInsertValue(UndefValue::get(CI->getType()), Loaded, 0);
Res = Builder.CreateInsertValue(Res, Success, 1);

CI->replaceAllUsesWith(Res);
Expand Down Expand Up @@ -1923,7 +1923,7 @@ bool AtomicExpand::expandAtomicOpToLibcall(
// The final result from the CAS is {load of 'expected' alloca, bool result
// from call}
Type *FinalResultTy = I->getType();
Value *V = PoisonValue::get(FinalResultTy);
Value *V = UndefValue::get(FinalResultTy);
Value *ExpectedOut = Builder.CreateAlignedLoad(
CASExpected->getType(), AllocaCASExpected, AllocaAlignment);
Builder.CreateLifetimeEnd(AllocaCASExpected_i8, SizeVal64);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ define void @pointer_cmpxchg_expand(i8** %ptr, i8* %v) {
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } poison, i8* %6, 0
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
cmpxchg i8** %ptr, i8* null, i8* %v seq_cst monotonic
ret void
Expand All @@ -102,7 +102,7 @@ define void @pointer_cmpxchg_expand2(i8** %ptr, i8* %v) {
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } poison, i8* %6, 0
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
cmpxchg i8** %ptr, i8* null, i8* %v release monotonic
ret void
Expand All @@ -116,7 +116,7 @@ define void @pointer_cmpxchg_expand3(i8** %ptr, i8* %v) {
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } poison, i8* %6, 0
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
cmpxchg i8** %ptr, i8* null, i8* %v seq_cst seq_cst
ret void
Expand All @@ -130,7 +130,7 @@ define void @pointer_cmpxchg_expand4(i8** %ptr, i8* %v) {
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } poison, i8* %6, 0
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
cmpxchg weak i8** %ptr, i8* null, i8* %v seq_cst seq_cst
ret void
Expand All @@ -144,7 +144,7 @@ define void @pointer_cmpxchg_expand5(i8** %ptr, i8* %v) {
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8*
; CHECK: %7 = insertvalue { i8*, i1 } poison, i8* %6, 0
; CHECK: %7 = insertvalue { i8*, i1 } undef, i8* %6, 0
; CHECK: %8 = insertvalue { i8*, i1 } %7, i1 %5, 1
cmpxchg volatile i8** %ptr, i8* null, i8* %v seq_cst seq_cst
ret void
Expand All @@ -159,7 +159,7 @@ define void @pointer_cmpxchg_expand6(i8 addrspace(2)* addrspace(1)* %ptr,
; CHECK: %4 = extractvalue { i64, i1 } %3, 0
; CHECK: %5 = extractvalue { i64, i1 } %3, 1
; CHECK: %6 = inttoptr i64 %4 to i8 addrspace(2)*
; CHECK: %7 = insertvalue { i8 addrspace(2)*, i1 } poison, i8 addrspace(2)* %6, 0
; CHECK: %7 = insertvalue { i8 addrspace(2)*, i1 } undef, i8 addrspace(2)* %6, 0
; CHECK: %8 = insertvalue { i8 addrspace(2)*, i1 } %7, i1 %5, 1
cmpxchg i8 addrspace(2)* addrspace(1)* %ptr, i8 addrspace(2)* null, i8 addrspace(2)* %v seq_cst seq_cst
ret void
Expand Down

0 comments on commit b50e1bd

Please sign in to comment.