[llvm] e5c5f92 - [InstCombine] switch synthetic unreachable to use undef instead of poison (NFC)

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 13:54:27 PDT 2022


Author: Nuno Lopes
Date: 2022-06-10T21:54:09+01:00
New Revision: e5c5f92e12827fcf969002b1472b6ad9c08b1f14

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

LOG: [InstCombine] switch synthetic unreachable to use undef instead of poison (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineInternal.h
    llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll
    llvm/test/Transforms/InstCombine/pr44245.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 6340c9996108..dcfc32ffb012 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -411,7 +411,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
     // If we are replacing the instruction with itself, this must be in a
     // segment of unreachable code, so just clobber the instruction.
     if (&I == V)
-      V = UndefValue::get(I.getType());
+      V = PoisonValue::get(I.getType());
 
     LLVM_DEBUG(dbgs() << "IC: Replacing " << I << "\n"
                       << "    with " << *V << '\n');
@@ -439,7 +439,7 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   void CreateNonTerminatorUnreachable(Instruction *InsertAt) {
     auto &Ctx = InsertAt->getContext();
     new StoreInst(ConstantInt::getTrue(Ctx),
-                  UndefValue::get(Type::getInt1PtrTy(Ctx)),
+                  PoisonValue::get(Type::getInt1PtrTy(Ctx)),
                   InsertAt);
   }
 

diff  --git a/llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll b/llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll
index 183e22e037d2..9e0d1ee376f1 100644
--- a/llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll
+++ b/llvm/test/Transforms/InstCombine/element-atomic-memintrins.ll
@@ -420,7 +420,7 @@ define void @test_undefined(i8* %dest, i8* %src, i1 %c1) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br i1 [[C1:%.*]], label [[OK:%.*]], label [[UNDEFINED:%.*]]
 ; CHECK:       undefined:
-; CHECK-NEXT:    store i1 true, i1* undef, align 1
+; CHECK-NEXT:    store i1 true, i1* poison, align 1
 ; CHECK-NEXT:    br label [[OK]]
 ; CHECK:       ok:
 ; CHECK-NEXT:    ret void

diff  --git a/llvm/test/Transforms/InstCombine/pr44245.ll b/llvm/test/Transforms/InstCombine/pr44245.ll
index 1c123457383d..3ecd9028e923 100644
--- a/llvm/test/Transforms/InstCombine/pr44245.ll
+++ b/llvm/test/Transforms/InstCombine/pr44245.ll
@@ -59,7 +59,7 @@ define void @test(i1 %c) {
 ; CHECK-NEXT:    br label [[BB47]]
 ; CHECK:       bb152:
 ; CHECK-NEXT:    [[TMP1848]] = load i8*, i8** inttoptr (i64 16 to i8**), align 16
-; CHECK-NEXT:    store i1 true, i1* undef, align 1
+; CHECK-NEXT:    store i1 true, i1* poison, align 1
 ; CHECK-NEXT:    br label [[BB150]]
 ;
 bb16:                                             ; preds = %bb


        


More information about the llvm-commits mailing list