[llvm] b50e1bd - Revert "[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]"

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 04:41:36 PST 2022


Author: Nuno Lopes
Date: 2022-11-22T12:41:22Z
New Revision: b50e1bd60520aee5957a2cb96054a2d4f61f9181

URL: https://github.com/llvm/llvm-project/commit/b50e1bd60520aee5957a2cb96054a2d4f61f9181
DIFF: https://github.com/llvm/llvm-project/commit/b50e1bd60520aee5957a2cb96054a2d4f61f9181.diff

LOG: Revert "[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]"

This reverts commit f50423c1a4422900aa1240fed643f5920451a88d.

Added: 
    

Modified: 
    llvm/lib/CodeGen/AtomicExpandPass.cpp
    llvm/test/Transforms/AtomicExpand/X86/expand-atomic-non-integer.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index 56859b0434d7..926ec8704bee 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -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);
 
@@ -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");
@@ -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);
 
@@ -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);
@@ -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);

diff  --git a/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-non-integer.ll b/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-non-integer.ll
index 50cd74b0c4d8..637d29cb6142 100644
--- a/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-non-integer.ll
+++ b/llvm/test/Transforms/AtomicExpand/X86/expand-atomic-non-integer.ll
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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


        


More information about the llvm-commits mailing list