[llvm] 6ef9a2a - [LICM] Use poison to replace unreachable values instead of undef [NFC]
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 26 06:56:42 PDT 2022
Author: Nuno Lopes
Date: 2022-06-26T14:56:35+01:00
New Revision: 6ef9a2ad01c07072352ce228e41b2aa44483d421
URL: https://github.com/llvm/llvm-project/commit/6ef9a2ad01c07072352ce228e41b2aa44483d421
DIFF: https://github.com/llvm/llvm-project/commit/6ef9a2ad01c07072352ce228e41b2aa44483d421.diff
LOG: [LICM] Use poison to replace unreachable values instead of undef [NFC]
Added:
Modified:
llvm/lib/Transforms/Scalar/LICM.cpp
llvm/test/Transforms/LICM/PR19798.ll
llvm/test/Transforms/LICM/PR24013.ll
llvm/test/Transforms/LICM/pr35342.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 2cb59509af7fc..492f4e40395a1 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -1606,7 +1606,7 @@ static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
continue;
if (!DT->isReachableFromEntry(User->getParent())) {
- U = UndefValue::get(I.getType());
+ U = PoisonValue::get(I.getType());
Changed = true;
continue;
}
@@ -1619,7 +1619,7 @@ static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
// unreachable.
BasicBlock *BB = PN->getIncomingBlock(U);
if (!DT->isReachableFromEntry(BB)) {
- U = UndefValue::get(I.getType());
+ U = PoisonValue::get(I.getType());
Changed = true;
continue;
}
diff --git a/llvm/test/Transforms/LICM/PR19798.ll b/llvm/test/Transforms/LICM/PR19798.ll
index 82befb09666ca..4670f0e375342 100644
--- a/llvm/test/Transforms/LICM/PR19798.ll
+++ b/llvm/test/Transforms/LICM/PR19798.ll
@@ -1,20 +1,20 @@
; RUN: opt -licm -S < %s | FileCheck %s
-define void @f() {
+define void @f(i1 %c) {
; CHECK-LABEL: @f(
entry:
br label %bb0
bb0:
- %tobool7 = icmp eq i1 undef, undef
+ %tobool7 = icmp eq i1 0, 1
br label %bb1
bb1:
- br i1 undef, label %bb0, label %bb0
+ br i1 %c, label %bb0, label %bb0
unreachable:
; CHECK-LABEL: unreachable:
-; CHECK: br i1 undef, label %unreachable, label %unreachable
+; CHECK: br i1 poison, label %unreachable, label %unreachable
br i1 %tobool7, label %unreachable, label %unreachable
bb3:
diff --git a/llvm/test/Transforms/LICM/PR24013.ll b/llvm/test/Transforms/LICM/PR24013.ll
index 4557bfcfd1226..7f8489e5a0de4 100644
--- a/llvm/test/Transforms/LICM/PR24013.ll
+++ b/llvm/test/Transforms/LICM/PR24013.ll
@@ -9,11 +9,11 @@ lbl.loopexit: ; No predecessors!
br label %lbl
lbl: ; preds = %lbl.loopexit, %entry
- %phi = phi i32 [ %conv, %lbl.loopexit ], [ undef, %entry ]
-; CHECK: phi i32 [ undef, {{.*}} ], [ undef
+ %phi = phi i32 [ %conv, %lbl.loopexit ], [ poison, %entry ]
+; CHECK: phi i32 [ poison, {{.*}} ], [ poison
br label %if.then.5
if.then.5: ; preds = %if.then.5, %lbl
- %conv = zext i1 undef to i32
+ %conv = zext i1 0 to i32
br label %if.then.5
}
diff --git a/llvm/test/Transforms/LICM/pr35342.ll b/llvm/test/Transforms/LICM/pr35342.ll
index d6af208e2f2d8..481118357e32b 100644
--- a/llvm/test/Transforms/LICM/pr35342.ll
+++ b/llvm/test/Transforms/LICM/pr35342.ll
@@ -5,16 +5,16 @@ target triple = "x86_64-unknown-linux-gnu"
; CHECK-LABEL: @f1
; CHECK-LABEL: bci_524:
-; CHECK: add i32 undef, undef
-define void @f1(i32 %v) {
+; CHECK: add i32 poison, poison
+define void @f1(i32 %v, i1 %c) {
not_zero.lr.ph:
br label %not_zero
not_zero:
- br i1 undef, label %bci_748 , label %bci_314
+ br i1 %c, label %bci_748 , label %bci_314
bci_314:
- %0 = select i1 undef, i32 undef, i32 undef
+ %0 = select i1 poison, i32 poison, i32 poison
br label %not_zero
bci_524: ; No predecessors!
More information about the llvm-commits
mailing list