[llvm] 16bb8c1 - [SCCP] Use poison instead of undef when zapping returns

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 03:38:27 PDT 2024


Author: Nikita Popov
Date: 2024-06-25T12:35:25+02:00
New Revision: 16bb8c16aab32e2ee623a2b64d976548be247180

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

LOG: [SCCP] Use poison instead of undef when zapping returns

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/SCCP.cpp
    llvm/test/Transforms/FunctionSpecialization/track-return.ll
    llvm/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
    llvm/test/Transforms/SCCP/apint-ipsccp2.ll
    llvm/test/Transforms/SCCP/arg-count-mismatch.ll
    llvm/test/Transforms/SCCP/indirectbr.ll
    llvm/test/Transforms/SCCP/ip-constant-ranges.ll
    llvm/test/Transforms/SCCP/ip-ranges-phis.ll
    llvm/test/Transforms/SCCP/ip-ranges-select.ll
    llvm/test/Transforms/SCCP/ipsccp-basic.ll
    llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll
    llvm/test/Transforms/SCCP/ipsccp-noundef.ll
    llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll
    llvm/test/Transforms/SCCP/issue59602-assume-like-call-users.ll
    llvm/test/Transforms/SCCP/metadata.ll
    llvm/test/Transforms/SCCP/musttail-call.ll
    llvm/test/Transforms/SCCP/range-and-ip.ll
    llvm/test/Transforms/SCCP/range-attribute.ll
    llvm/test/Transforms/SCCP/remove-call-inst.ll
    llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
    llvm/test/Transforms/SCCP/return-constant.ll
    llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
    llvm/test/Transforms/SCCP/struct-arg-resolve-undefs.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/SCCP.cpp b/llvm/lib/Transforms/IPO/SCCP.cpp
index e591a8e73b1c6..94ae511b2e4a1 100644
--- a/llvm/lib/Transforms/IPO/SCCP.cpp
+++ b/llvm/lib/Transforms/IPO/SCCP.cpp
@@ -316,7 +316,7 @@ static bool runIPSCCP(
   SmallSetVector<Function *, 8> FuncZappedReturn;
   for (ReturnInst *RI : ReturnsToZap) {
     Function *F = RI->getParent()->getParent();
-    RI->setOperand(0, UndefValue::get(F->getReturnType()));
+    RI->setOperand(0, PoisonValue::get(F->getReturnType()));
     // Record all functions that are zapped.
     FuncZappedReturn.insert(F);
   }

diff  --git a/llvm/test/Transforms/FunctionSpecialization/track-return.ll b/llvm/test/Transforms/FunctionSpecialization/track-return.ll
index 54e5de018f19c..aaff6c138bbaa 100644
--- a/llvm/test/Transforms/FunctionSpecialization/track-return.ll
+++ b/llvm/test/Transforms/FunctionSpecialization/track-return.ll
@@ -24,7 +24,7 @@ define internal i64 @foo(i1 %flag, i64 %m, i64 %n) {
 ; CHECK-NEXT:    [[RES0:%.*]] = call i64 @bar.specialized.6(i64 4)
 ; CHECK-NEXT:    br label %merge
 ; CHECK:       merge:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 ; CHECK:       define internal i64 @foo.specialized.2
 ; CHECK-NEXT:  entry:
@@ -34,7 +34,7 @@ define internal i64 @foo(i1 %flag, i64 %m, i64 %n) {
 ; CHECK-NEXT:    [[RES1:%.*]] = call i64 @bar.specialized.5(i64 3)
 ; CHECK-NEXT:    br label %merge
 ; CHECK:       merge:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 entry:
   br i1 %flag, label %plus, label %minus
@@ -58,11 +58,11 @@ define internal i64 @binop(i64 %x, i64 %y) {
 ;
 ; CHECK:       define internal i64 @binop.specialized.3
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 ; CHECK:       define internal i64 @binop.specialized.4
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 entry:
   %z = add i64 %x, %y
@@ -77,7 +77,7 @@ define internal i64 @bar(i64 %n) {
 ; CHECK:       if.else:
 ; CHECK-NEXT:    br label %if.end
 ; CHECK:       if.end:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 ; CHECK:       define internal i64 @bar.specialized.6
 ; CHECK-NEXT:  entry:
@@ -85,7 +85,7 @@ define internal i64 @bar(i64 %n) {
 ; CHECK:       if.then:
 ; CHECK-NEXT:    br label %if.end
 ; CHECK:       if.end:
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
 entry:
   %cmp = icmp sgt i64 %n, 3

diff  --git a/llvm/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll b/llvm/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
index 3fb9c8885f662..fddd000308773 100644
--- a/llvm/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
+++ b/llvm/test/Transforms/SCCP/2009-01-14-IPSCCP-Invoke.ll
@@ -27,7 +27,7 @@ UnifiedReturnBlock:
 
 define internal i32 @f() {
 ; CHECK-LABEL: define internal i32 @f() {
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   ret i32 42
 }

diff  --git a/llvm/test/Transforms/SCCP/apint-ipsccp2.ll b/llvm/test/Transforms/SCCP/apint-ipsccp2.ll
index 4f2fcd3bdb0a1..a80fb4db8fe73 100644
--- a/llvm/test/Transforms/SCCP/apint-ipsccp2.ll
+++ b/llvm/test/Transforms/SCCP/apint-ipsccp2.ll
@@ -7,7 +7,7 @@ define internal i101 @bar(i101 %A) {
 ; CHECK-NEXT:    br label %[[T:.*]]
 ; CHECK:       [[T]]:
 ; CHECK-NEXT:    [[B:%.*]] = call i101 @bar(i101 0)
-; CHECK-NEXT:    ret i101 undef
+; CHECK-NEXT:    ret i101 poison
 ;
   %x = icmp eq i101 %A, 0
   br i1 %x, label %T, label %F

diff  --git a/llvm/test/Transforms/SCCP/arg-count-mismatch.ll b/llvm/test/Transforms/SCCP/arg-count-mismatch.ll
index 54bf8d349b831..c2c5248be41f3 100644
--- a/llvm/test/Transforms/SCCP/arg-count-mismatch.ll
+++ b/llvm/test/Transforms/SCCP/arg-count-mismatch.ll
@@ -56,7 +56,7 @@ define internal i16 @bar(i16 %p1, i16 %p2) {
 define internal i16 @vararg_prop(i16 %p1, ...) {
 ; CHECK-LABEL: define {{[^@]+}}@vararg_prop
 ; CHECK-SAME: (i16 [[P1:%.*]], ...) {
-; CHECK-NEXT:    ret i16 undef
+; CHECK-NEXT:    ret i16 poison
 ;
   ret i16 %p1
 }

diff  --git a/llvm/test/Transforms/SCCP/indirectbr.ll b/llvm/test/Transforms/SCCP/indirectbr.ll
index 280bc53ff2623..d9235e0f84cb2 100644
--- a/llvm/test/Transforms/SCCP/indirectbr.ll
+++ b/llvm/test/Transforms/SCCP/indirectbr.ll
@@ -104,7 +104,7 @@ define internal i32 @indbrtest5(i1 %c) {
 ; CHECK:       target1:
 ; CHECK-NEXT:    br label [[TARGET2]]
 ; CHECK:       target2:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   br i1 %c, label %bb1, label %bb2

diff  --git a/llvm/test/Transforms/SCCP/ip-constant-ranges.ll b/llvm/test/Transforms/SCCP/ip-constant-ranges.ll
index 07068441ae4f4..c0cdfafe71cb2 100644
--- a/llvm/test/Transforms/SCCP/ip-constant-ranges.ll
+++ b/llvm/test/Transforms/SCCP/ip-constant-ranges.ll
@@ -6,7 +6,7 @@ define internal i32 @f1(i32 %a, i32 %b) {
 ; CHECK-LABEL: define {{[^@]+}}@f1
 ; CHECK-SAME: (i32 [[A:%.*]], i32 [[B:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   %cmp.a = icmp sgt i32 %a, 300
@@ -81,7 +81,7 @@ define internal i32 @f3(i32 %x) {
 ; CHECK-LABEL: define {{[^@]+}}@f3
 ; CHECK-SAME: (i32 [[X:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   %cmp = icmp sgt i32 %x, 300
@@ -118,7 +118,7 @@ define internal i32 @f4(i32 %x) {
 ; CHECK-LABEL: define {{[^@]+}}@f4
 ; CHECK-SAME: (i32 [[X:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   %cmp = icmp sgt i32 %x, 300
@@ -172,7 +172,7 @@ define internal i1 @test_unreachable_callee(i32 %a) {
 ; CHECK-LABEL: define {{[^@]+}}@test_unreachable_callee
 ; CHECK-SAME: (i32 [[A:%.*]]) {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
 entry:
   ret i1 true
@@ -284,7 +284,7 @@ define internal i32 @callee6.1(i32 %i) {
 ; CHECK-LABEL: define {{[^@]+}}@callee6.1
 ; CHECK-SAME: (i32 [[I:%.*]]) {
 ; CHECK-NEXT:    [[RES:%.*]] = call i32 @callee6.2(i32 [[I]])
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %res = call i32 @callee6.2(i32 %i)
   ret i32 %res
@@ -295,7 +295,7 @@ define internal i32 @callee6.2(i32 %i) {
 ; CHECK-SAME: (i32 [[I:%.*]]) {
 ; CHECK-NEXT:    br label [[IF_THEN:%.*]]
 ; CHECK:       if.then:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 
   %cmp = icmp ne i32 %i, 0

diff  --git a/llvm/test/Transforms/SCCP/ip-ranges-phis.ll b/llvm/test/Transforms/SCCP/ip-ranges-phis.ll
index e5a48ceabc2a2..4fb73c532f2e2 100644
--- a/llvm/test/Transforms/SCCP/ip-ranges-phis.ll
+++ b/llvm/test/Transforms/SCCP/ip-ranges-phis.ll
@@ -4,7 +4,7 @@
 define internal i32 @f1(i32 %x) {
 ; CHECK-LABEL: define {{[^@]+}}@f1
 ; CHECK-SAME: (i32 [[X:%.*]]) {
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %cmp = icmp sgt i32 %x, 300
   %res = select i1 %cmp, i32 1, i32 2

diff  --git a/llvm/test/Transforms/SCCP/ip-ranges-select.ll b/llvm/test/Transforms/SCCP/ip-ranges-select.ll
index 026b737dd6abf..7a507eaa74b1a 100644
--- a/llvm/test/Transforms/SCCP/ip-ranges-select.ll
+++ b/llvm/test/Transforms/SCCP/ip-ranges-select.ll
@@ -22,7 +22,7 @@ define internal i32 @callee.1(i32 %arg) {
 ; CHECK-NEXT:    [[SEL:%.*]] = select i1 false, i32 16, i32 [[ARG]]
 ; CHECK-NEXT:    br label [[BB10:%.*]]
 ; CHECK:       bb10:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %c.1 = icmp slt i32 %arg, 0
   %sel = select i1 %c.1, i32 16, i32 %arg

diff  --git a/llvm/test/Transforms/SCCP/ipsccp-basic.ll b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
index 6a7ab8ac2864c..9ab686aa701f4 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-basic.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-basic.ll
@@ -8,7 +8,7 @@
 define internal i32 @test1a(i32 %A) {
 ; CHECK-LABEL: define internal i32 @test1a
 ; CHECK-SAME: (i32 [[A:%.*]]) {
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %X = add i32 1, 2
   ret i32 %A
@@ -34,7 +34,7 @@ define internal i32 @test2a(i32 %A) {
 ; CHECK-NEXT:    br label [[T:%.*]]
 ; CHECK:       T:
 ; CHECK-NEXT:    [[B:%.*]] = call i32 @test2a(i32 0)
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %C = icmp eq i32 %A, 0
   br i1 %C, label %T, label %F
@@ -97,7 +97,7 @@ F:
 
 define internal {i64,i64} @test4a() {
 ; CHECK-LABEL: define internal { i64, i64 } @test4a() {
-; CHECK-NEXT:    ret { i64, i64 } undef
+; CHECK-NEXT:    ret { i64, i64 } poison
 ;
   %a = insertvalue {i64,i64} undef, i64 4, 1
   %b = insertvalue {i64,i64} %a, i64 5, 0
@@ -107,13 +107,13 @@ define internal {i64,i64} @test4a() {
 define i64 @test4b() personality ptr @__gxx_personality_v0 {
 ; CHECK-LABEL: define range(i64 0, 6) i64 @test4b() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:    [[A:%.*]] = invoke { i64, i64 } @test4a()
-; CHECK-NEXT:    to label [[A:%.*]] unwind label [[B:%.*]]
+; CHECK-NEXT:            to label [[A:%.*]] unwind label [[B:%.*]]
 ; CHECK:       A:
 ; CHECK-NEXT:    [[C:%.*]] = call i64 @test4c(i64 5)
 ; CHECK-NEXT:    ret i64 5
 ; CHECK:       B:
 ; CHECK-NEXT:    [[VAL:%.*]] = landingpad { ptr, i32 }
-; CHECK-NEXT:    catch ptr null
+; CHECK-NEXT:            catch ptr null
 ; CHECK-NEXT:    ret i64 0
 ;
   %a = invoke {i64,i64} @test4a()
@@ -131,7 +131,7 @@ B:
 define internal i64 @test4c(i64 %a) {
 ; CHECK-LABEL: define internal i64 @test4c
 ; CHECK-SAME: (i64 [[A:%.*]]) {
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
   ret i64 %a
 }
@@ -141,7 +141,7 @@ define internal i64 @test4c(i64 %a) {
 ; PR4313
 define internal {i64,i64} @test5a() {
 ; CHECK-LABEL: define internal { i64, i64 } @test5a() {
-; CHECK-NEXT:    ret { i64, i64 } undef
+; CHECK-NEXT:    ret { i64, i64 } poison
 ;
   %a = insertvalue {i64,i64} undef, i64 4, 1
   %b = insertvalue {i64,i64} %a, i64 5, 0
@@ -151,13 +151,13 @@ define internal {i64,i64} @test5a() {
 define i64 @test5b() personality ptr @__gxx_personality_v0 {
 ; CHECK-LABEL: define range(i64 0, 6) i64 @test5b() personality ptr @__gxx_personality_v0 {
 ; CHECK-NEXT:    [[A:%.*]] = invoke { i64, i64 } @test5a()
-; CHECK-NEXT:    to label [[A:%.*]] unwind label [[B:%.*]]
+; CHECK-NEXT:            to label [[A:%.*]] unwind label [[B:%.*]]
 ; CHECK:       A:
 ; CHECK-NEXT:    [[C:%.*]] = call i64 @test5c({ i64, i64 } { i64 5, i64 4 })
 ; CHECK-NEXT:    ret i64 5
 ; CHECK:       B:
 ; CHECK-NEXT:    [[VAL:%.*]] = landingpad { ptr, i32 }
-; CHECK-NEXT:    catch ptr null
+; CHECK-NEXT:            catch ptr null
 ; CHECK-NEXT:    ret i64 0
 ;
   %a = invoke {i64,i64} @test5a()
@@ -174,7 +174,7 @@ B:
 define internal i64 @test5c({i64,i64} %a) {
 ; CHECK-LABEL: define internal i64 @test5c
 ; CHECK-SAME: ({ i64, i64 } [[A:%.*]]) {
-; CHECK-NEXT:    ret i64 undef
+; CHECK-NEXT:    ret i64 poison
 ;
   %b = extractvalue {i64,i64} %a, 0
   ret i64 %b
@@ -206,7 +206,7 @@ define i64 @test6b() {
 define internal %T @test7a(i32 %A) {
 ; CHECK-LABEL: define internal %T @test7a
 ; CHECK-SAME: (i32 [[A:%.*]]) {
-; CHECK-NEXT:    ret [[T:%.*]] undef
+; CHECK-NEXT:    ret [[T:%.*]] poison
 ;
   %X = add i32 1, %A
   %mrv0 = insertvalue %T undef, i32 %X, 0
@@ -216,7 +216,7 @@ define internal %T @test7a(i32 %A) {
 
 define i32 @test7b() {
 ; CHECK-LABEL: define i32 @test7b() {
-; CHECK-NEXT:    [[X:%.*]] = call [[T:%.*]] @test7a(i32 17)
+; CHECK-NEXT:    [[X:%.*]] = call [[T:%.*]] @[[TEST7A:[a-zA-Z0-9_$\"\\.-]*[a-zA-Z_$\"\\.-][a-zA-Z0-9_$\"\\.-]*]](i32 17)
 ; CHECK-NEXT:    ret i32 36
 ;
   %X = call %T @test7a(i32 17)
@@ -232,7 +232,7 @@ define internal {} @test8a(i32 %A, ptr %P) {
 ; CHECK-LABEL: define internal {} @test8a
 ; CHECK-SAME: (i32 [[A:%.*]], ptr [[P:%.*]]) {
 ; CHECK-NEXT:    store i32 5, ptr [[P]], align 4
-; CHECK-NEXT:    ret {} undef
+; CHECK-NEXT:    ret {} poison
 ;
   store i32 %A, ptr %P
   ret {} {}

diff  --git a/llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll b/llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll
index 64bc3dbdbb5f3..0b1d89f99f788 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-clear-returned.ll
@@ -20,7 +20,7 @@ define internal i32 @func_return_undef(i32 returned %arg) {
 ; CHECK-LABEL: define internal i32 @func_return_undef(
 ; CHECK-SAME: i32 [[ARG:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   ret i32 %arg
@@ -44,7 +44,7 @@ define internal i32 @blockaddr_user(i1 %c, i32 returned %d) {
 ; CHECK:       [[TARGET1]]:
 ; CHECK-NEXT:    br label %[[TARGET2]]
 ; CHECK:       [[TARGET2]]:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   br i1 %c, label %bb1, label %bb2

diff  --git a/llvm/test/Transforms/SCCP/ipsccp-noundef.ll b/llvm/test/Transforms/SCCP/ipsccp-noundef.ll
index 2f7eb725a4f41..261e99e1bf91f 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-noundef.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-noundef.ll
@@ -4,21 +4,21 @@
 
 define internal noundef i32 @ret_noundef() {
 ; CHECK-LABEL: define internal i32 @ret_noundef() {
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   ret i32 0
 }
 
 define internal dereferenceable(1) ptr @ret_dereferenceable() {
 ; CHECK-LABEL: define internal ptr @ret_dereferenceable() {
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
   ret ptr @g
 }
 
 define internal dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() {
 ; CHECK-LABEL: define internal ptr @ret_dereferenceable_or_null() {
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
   ret ptr @g
 }
@@ -26,14 +26,14 @@ define internal dereferenceable_or_null(1) ptr @ret_dereferenceable_or_null() {
 ; Non-null is fine, because it does not cause immediate UB.
 define internal nonnull ptr @ret_nonnull() {
 ; CHECK-LABEL: define internal nonnull ptr @ret_nonnull() {
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
   ret ptr @g
 }
 
 define internal nonnull ptr @ret_nonnull_noundef() {
 ; CHECK-LABEL: define internal nonnull ptr @ret_nonnull_noundef() {
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
   ret ptr @g
 }

diff  --git a/llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll b/llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll
index 62ef2294cb2c6..678ef916e466f 100644
--- a/llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll
+++ b/llvm/test/Transforms/SCCP/ipsccp-preserve-analysis.ll
@@ -25,7 +25,7 @@ define internal i32 @f1() readnone {
 ; IR-NEXT:  [[ENTRY:.*:]]
 ; IR-NEXT:    br label %[[BB2:.*]]
 ; IR:       [[BB2]]:
-; IR-NEXT:    ret i32 undef
+; IR-NEXT:    ret i32 poison
 ;
 entry:
   br i1 false, label %bb1, label %bb2

diff  --git a/llvm/test/Transforms/SCCP/issue59602-assume-like-call-users.ll b/llvm/test/Transforms/SCCP/issue59602-assume-like-call-users.ll
index 352eb21095c23..260966b8b505b 100644
--- a/llvm/test/Transforms/SCCP/issue59602-assume-like-call-users.ll
+++ b/llvm/test/Transforms/SCCP/issue59602-assume-like-call-users.ll
@@ -20,7 +20,7 @@ define internal i32 @assume_self_user() {
 ; CHECK-LABEL: define {{[^@]+}}@assume_self_user() {
 ; CHECK-NEXT:    [[OBJSIZE:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr @assume_self_user, i1 false, i1 false, i1 false)
 ; CHECK-NEXT:    store i32 [[OBJSIZE]], ptr @extern, align 4
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %objsize = call i32 @llvm.objectsize.i32.p0(ptr @assume_self_user, i1 false, i1 false, i1 false)
   store i32 %objsize, ptr @extern
@@ -50,7 +50,7 @@ define internal i32 @constexpr_self_user(i32 %arg0) addrspace(1) {
 ; CHECK-SAME: (i32 [[ARG0:%.*]]) addrspace(1) {
 ; CHECK-NEXT:    [[OBJSIZE:%.*]] = call i32 @llvm.objectsize.i32.p0(ptr addrspacecast (ptr addrspace(1) @constexpr_self_user to ptr), i1 false, i1 false, i1 false)
 ; CHECK-NEXT:    store i32 [[OBJSIZE]], ptr @extern, align 4
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   %objsize = call i32 @llvm.objectsize.i32.p0(ptr addrspacecast (ptr addrspace(1) @constexpr_self_user to ptr), i1 false, i1 false, i1 false)
   store i32 %objsize, ptr @extern

diff  --git a/llvm/test/Transforms/SCCP/metadata.ll b/llvm/test/Transforms/SCCP/metadata.ll
index 8b1299c856611..b89b7fa7dbbb3 100644
--- a/llvm/test/Transforms/SCCP/metadata.ll
+++ b/llvm/test/Transforms/SCCP/metadata.ll
@@ -6,7 +6,7 @@ declare i32 @get_i32()
 
 define void @load_range(ptr %p) {
 ; CHECK-LABEL: @load_range(
-; CHECK-NEXT:    [[V:%.*]] = load i32, ptr [[P:%.*]], align 4, !range !0
+; CHECK-NEXT:    [[V:%.*]] = load i32, ptr [[P:%.*]], align 4, !range [[RNG0:![0-9]+]]
 ; CHECK-NEXT:    call void @use(i1 true)
 ; CHECK-NEXT:    [[C2:%.*]] = icmp ult i32 [[V]], 9
 ; CHECK-NEXT:    call void @use(i1 [[C2]])
@@ -37,7 +37,7 @@ define i32 @load_range_single(ptr %p) {
 
 define i32 @load_range_single_volatile(ptr %p) {
 ; CHECK-LABEL: @load_range_single_volatile(
-; CHECK-NEXT:    [[V:%.*]] = load volatile i32, ptr [[P:%.*]], align 4, !range !1
+; CHECK-NEXT:    [[V:%.*]] = load volatile i32, ptr [[P:%.*]], align 4, !range [[RNG1:![0-9]+]]
 ; CHECK-NEXT:    ret i32 [[V]]
 ;
   %v = load volatile i32, ptr %p, !range !{i32 0, i32 1}
@@ -46,8 +46,8 @@ define i32 @load_range_single_volatile(ptr %p) {
 
 define void @load_nonnull(ptr %p, ptr %p2) {
 ; CHECK-LABEL: @load_nonnull(
-; CHECK-NEXT:    [[V:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull !2
-; CHECK-NEXT:    [[V2:%.*]] = load ptr, ptr [[P2:%.*]], align 8, !nonnull !2
+; CHECK-NEXT:    [[V:%.*]] = load ptr, ptr [[P:%.*]], align 8, !nonnull [[META2:![0-9]+]]
+; CHECK-NEXT:    [[V2:%.*]] = load ptr, ptr [[P2:%.*]], align 8, !nonnull [[META2]]
 ; CHECK-NEXT:    call void @use(i1 true)
 ; CHECK-NEXT:    call void @use(i1 false)
 ; CHECK-NEXT:    call void @use(i1 true)
@@ -78,7 +78,7 @@ define void @load_nonnull(ptr %p, ptr %p2) {
 
 define void @call_range(ptr %p) {
 ; CHECK-LABEL: @call_range(
-; CHECK-NEXT:    [[V:%.*]] = call i32 @get_i32(), !range !0
+; CHECK-NEXT:    [[V:%.*]] = call i32 @get_i32(), !range [[RNG0]]
 ; CHECK-NEXT:    call void @use(i1 true)
 ; CHECK-NEXT:    [[C2:%.*]] = icmp ult i32 [[V]], 9
 ; CHECK-NEXT:    call void @use(i1 [[C2]])
@@ -101,7 +101,7 @@ define void @call_range(ptr %p) {
 
 define internal i1 @ip_cmp_range(i32 %v) {
 ; CHECK-LABEL: @ip_cmp_range(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp ult i32 %v, 10
   ret i1 %c
@@ -109,7 +109,7 @@ define internal i1 @ip_cmp_range(i32 %v) {
 
 define i1 @ip_load_range(ptr %p) {
 ; CHECK-LABEL: @ip_load_range(
-; CHECK-NEXT:    [[V:%.*]] = load i32, ptr [[P:%.*]], align 4, !range !0
+; CHECK-NEXT:    [[V:%.*]] = load i32, ptr [[P:%.*]], align 4, !range [[RNG0]]
 ; CHECK-NEXT:    [[C:%.*]] = call i1 @ip_cmp_range(i32 [[V]])
 ; CHECK-NEXT:    ret i1 true
 ;

diff  --git a/llvm/test/Transforms/SCCP/musttail-call.ll b/llvm/test/Transforms/SCCP/musttail-call.ll
index 964683e5886fd..085662aad8b85 100644
--- a/llvm/test/Transforms/SCCP/musttail-call.ll
+++ b/llvm/test/Transforms/SCCP/musttail-call.ll
@@ -62,7 +62,7 @@ define internal ptr @side_effects(i8 %v) {
 define internal ptr @no_side_effects(i8 %v) readonly nounwind willreturn {
 ; CHECK-LABEL: define {{[^@]+}}@no_side_effects
 ; CHECK-SAME: (i8 [[V:%.*]]) #[[ATTR0:[0-9]+]] {
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
   ret ptr null
 }

diff  --git a/llvm/test/Transforms/SCCP/range-and-ip.ll b/llvm/test/Transforms/SCCP/range-and-ip.ll
index 87646857c6546..d5d4b8022e1a7 100644
--- a/llvm/test/Transforms/SCCP/range-and-ip.ll
+++ b/llvm/test/Transforms/SCCP/range-and-ip.ll
@@ -38,7 +38,7 @@ define internal i1 @f1(i64 %r) {
 ; CHECK-LABEL: define internal i1 @f1(
 ; CHECK-SAME: i64 [[R:%.*]]) {
 ; CHECK-NEXT:    call void @sideeffect(i1 true, i64 [[R]])
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp ult i64 %r, 256
   call void @sideeffect(i1 %c, i64 %r)

diff  --git a/llvm/test/Transforms/SCCP/range-attribute.ll b/llvm/test/Transforms/SCCP/range-attribute.ll
index ae66af91bb8e3..209c5464ccf22 100644
--- a/llvm/test/Transforms/SCCP/range-attribute.ll
+++ b/llvm/test/Transforms/SCCP/range-attribute.ll
@@ -83,7 +83,7 @@ define void @call_range_result() {
 
 define internal i1 @ip_cmp_range_attribute(i32 %v) {
 ; CHECK-LABEL: @ip_cmp_range_attribute(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp ult i32 %v, 10
   ret i1 %c
@@ -100,7 +100,7 @@ define i1 @ip_range_attribute(i32 range(i32 0, 10) %v) {
 
 define internal i1 @ip_cmp_range_call(i32 %v) {
 ; CHECK-LABEL: @ip_cmp_range_call(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp ult i32 %v, 10
   ret i1 %c
@@ -119,7 +119,7 @@ define i1 @ip_range_call() {
 
 define internal i1 @ip_cmp_range_result(i32 %v) {
 ; CHECK-LABEL: @ip_cmp_range_result(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp ult i32 %v, 10
   ret i1 %c
@@ -138,7 +138,7 @@ define i1 @ip_range_result() {
 
 define internal i1 @ip_cmp_with_range_attribute(i32 range(i32 0, 10) %v) {
 ; CHECK-LABEL: @ip_cmp_with_range_attribute(
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
   %c = icmp eq i32 %v, 5
   ret i1 %c

diff  --git a/llvm/test/Transforms/SCCP/remove-call-inst.ll b/llvm/test/Transforms/SCCP/remove-call-inst.ll
index 6881b82a938fb..055a3235996ad 100644
--- a/llvm/test/Transforms/SCCP/remove-call-inst.ll
+++ b/llvm/test/Transforms/SCCP/remove-call-inst.ll
@@ -20,7 +20,7 @@ define internal i32 @wwrite(i64 %i) nounwind readnone willreturn {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    br label [[SW_DEFAULT:%.*]]
 ; CHECK:       sw.default:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   switch i64 %i, label %sw.default [

diff  --git a/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll b/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
index e5d77c6356e19..88e9e6568c647 100644
--- a/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
+++ b/llvm/test/Transforms/SCCP/resolvedundefsin-tracked-fn.ll
@@ -66,7 +66,7 @@ define internal i1 @test1_g(ptr %h, i32 %i) #0 {
 ; CHECK-NEXT:    br label [[LAND_END]]
 ; CHECK:       land.end:
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[TOBOOL1]], [[LAND_RHS]] ]
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
 entry:
   %tobool = icmp ne i32 %i, 0
@@ -142,7 +142,7 @@ define internal i1 @test2_g(ptr %h, i32 %i) {
 ; CHECK-NEXT:    [[TOBOOL1:%.*]] = icmp ne i32 [[CALL]], 0
 ; CHECK-NEXT:    br label [[LAND_END:%.*]]
 ; CHECK:       land.end:
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
 entry:
   %tobool = icmp ne i32 %i, 0
@@ -231,7 +231,7 @@ define internal i1 @test3_g(ptr %h, i32 %i) {
 ; CHECK-NEXT:    br label [[LAND_END]]
 ; CHECK:       land.end:
 ; CHECK-NEXT:    [[TMP0:%.*]] = phi i1 [ false, [[ENTRY:%.*]] ], [ [[TOBOOL1]], [[LAND_RHS]] ]
-; CHECK-NEXT:    ret i1 undef
+; CHECK-NEXT:    ret i1 poison
 ;
 entry:
   %tobool = icmp ne i32 %i, 0
@@ -294,7 +294,7 @@ define internal ptr @test4_c(ptr %arg) {
 ; CHECK:       bb2:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb3:
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
 bb1:                                              ; preds = %bb
   %tmp = and i1 undef, undef
@@ -345,7 +345,7 @@ define internal ptr @test5_c(ptr %arg) {
 ; CHECK:       bb2:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       bb3:
-; CHECK-NEXT:    ret ptr undef
+; CHECK-NEXT:    ret ptr poison
 ;
 bb1:                                              ; preds = %bb
   %tmp = and i1 undef, undef

diff  --git a/llvm/test/Transforms/SCCP/return-constant.ll b/llvm/test/Transforms/SCCP/return-constant.ll
index a6971af07f5df..8b361ea851c1e 100644
--- a/llvm/test/Transforms/SCCP/return-constant.ll
+++ b/llvm/test/Transforms/SCCP/return-constant.ll
@@ -5,9 +5,9 @@ define internal i32 @foo(i1 %C) {
 ; CHECK-LABEL: @foo(
 ; CHECK-NEXT:    br i1 [[C:%.*]], label [[T:%.*]], label [[F:%.*]]
 ; CHECK:       T:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ; CHECK:       F:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
   br i1 %C, label %T, label %F
 
@@ -31,12 +31,12 @@ define i1 @caller(i1 %C) {
 define i1 @invokecaller(i1 %C) personality ptr @__gxx_personality_v0 {
 ; CHECK-LABEL: @invokecaller(
 ; CHECK-NEXT:    [[X:%.*]] = invoke i32 @foo(i1 [[C:%.*]])
-; CHECK-NEXT:    to label [[OK:%.*]] unwind label [[FAIL:%.*]]
+; CHECK-NEXT:            to label [[OK:%.*]] unwind label [[FAIL:%.*]]
 ; CHECK:       OK:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       FAIL:
 ; CHECK-NEXT:    [[EXN:%.*]] = landingpad { ptr, i32 }
-; CHECK-NEXT:    cleanup
+; CHECK-NEXT:            cleanup
 ; CHECK-NEXT:    ret i1 false
 ;
   %X = invoke i32 @foo( i1 %C ) to label %OK unwind label %FAIL             ; <i32> [#uses=1]

diff  --git a/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll b/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
index 0d3e210aa9cf8..05f3358045c3c 100644
--- a/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
+++ b/llvm/test/Transforms/SCCP/solve-after-each-resolving-undefs-for-function.ll
@@ -10,7 +10,7 @@ define internal i32 @testf(i1 %c) {
 ; CHECK:       [[IF_COND]]:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       [[IF_END]]:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   br i1 %c, label %if.cond, label %if.end
@@ -35,7 +35,7 @@ define internal i32 @test1(i1 %c) {
 ; CHECK-NEXT:    [[CALL:%.*]] = call i32 @testf(i1 [[C]])
 ; CHECK-NEXT:    br label %[[RET1:.*]]
 ; CHECK:       [[RET1]]:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   br label %if.then

diff  --git a/llvm/test/Transforms/SCCP/struct-arg-resolve-undefs.ll b/llvm/test/Transforms/SCCP/struct-arg-resolve-undefs.ll
index f01ec6bb28093..b99ebe2e761e7 100644
--- a/llvm/test/Transforms/SCCP/struct-arg-resolve-undefs.ll
+++ b/llvm/test/Transforms/SCCP/struct-arg-resolve-undefs.ll
@@ -29,7 +29,7 @@ define internal i32 @f(%struct.S %s.coerce) {
 ; CHECK-NEXT:    [[INC]] = add nsw i32 [[I_0]], 1
 ; CHECK-NEXT:    br i1 [[CMP]], label %[[FOR_COND]], label %[[IF_END:.*]]
 ; CHECK:       [[IF_END]]:
-; CHECK-NEXT:    ret i32 undef
+; CHECK-NEXT:    ret i32 poison
 ;
 entry:
   %ev = extractvalue %struct.S %s.coerce, 0
@@ -51,7 +51,7 @@ define internal i8 @lsh(i8 %l, i32 %r) {
 ; CHECK-LABEL: define internal i8 @lsh(
 ; CHECK-SAME: i8 [[L:%.*]], i32 [[R:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*:]]
-; CHECK-NEXT:    ret i8 undef
+; CHECK-NEXT:    ret i8 poison
 ;
 entry:
   %conv = sext i8 %l to i32


        


More information about the llvm-commits mailing list