[llvm] [llvm] Remove `br i1 undef` from regression tests (PR #115691)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 23:16:01 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: Lee Wei (leewei05)

<details>
<summary>Changes</summary>

This PR aims to remove undefined behavior from tests under the directory `llvm/transforms/CodegenPrepare, ConstantHoisting, Coroutines` etc.

@<!-- -->nunoplopes @<!-- -->regehr 

---

Patch is 33.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/115691.diff


19 Files Affected:

- (modified) llvm/test/Transforms/CodeGenPrepare/X86/2008-11-24-RAUW-Self.ll (+2-2) 
- (modified) llvm/test/Transforms/CodeGenPrepare/X86/extend-sink-hoist.ll (+2-2) 
- (modified) llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll (+7-7) 
- (modified) llvm/test/Transforms/ConstantHoisting/ARM/same-offset-multi-types.ll (+2-2) 
- (modified) llvm/test/Transforms/ConstantHoisting/PowerPC/masks.ll (+6-6) 
- (modified) llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll (+5-5) 
- (modified) llvm/test/Transforms/Coroutines/coro-async-remat.ll (+9-9) 
- (modified) llvm/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll (+3-3) 
- (modified) llvm/test/Transforms/CorrelatedValuePropagation/basic.ll (+24-24) 
- (modified) llvm/test/Transforms/CorrelatedValuePropagation/crash.ll (+2-2) 
- (modified) llvm/test/Transforms/CorrelatedValuePropagation/pr35807.ll (+9-9) 
- (modified) llvm/test/Transforms/DeadStoreElimination/overlap.ll (+3-3) 
- (modified) llvm/test/Transforms/DeadStoreElimination/simple.ll (+3-3) 
- (modified) llvm/test/Transforms/EarlyCSE/X86/preserve_memoryssa.ll (+3-3) 
- (modified) llvm/test/Transforms/FixIrreducible/bug45623.ll (+14-13) 
- (modified) llvm/test/Transforms/FixIrreducible/unreachable.ll (+2-2) 
- (modified) llvm/test/Transforms/FunctionAttrs/nonnull.ll (+5-4) 
- (modified) llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll (+6-6) 
- (modified) llvm/test/Transforms/IRCE/pr57335.ll (+2-2) 


``````````diff
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/2008-11-24-RAUW-Self.ll b/llvm/test/Transforms/CodeGenPrepare/X86/2008-11-24-RAUW-Self.ll
index 5b501ed980a5e5..214cb33287a9e6 100644
--- a/llvm/test/Transforms/CodeGenPrepare/X86/2008-11-24-RAUW-Self.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/X86/2008-11-24-RAUW-Self.ll
@@ -3,7 +3,7 @@
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 target triple = "x86_64-unknown-linux-gnu"
 
-define fastcc i32 @ascii2flt(ptr %str) nounwind {
+define fastcc i32 @ascii2flt(ptr %str, i1 %arg) nounwind {
 entry:
 	br label %bb2.i
 
@@ -45,7 +45,7 @@ bb10.i196.bb7.i197_crit_edge:		; No predecessors!
 
 bb7.i197:		; preds = %bb10.i196.bb7.i197_crit_edge, %base2flt.exit.bb7.i197_crit_edge, %bb11.i.bb7.i197_crit_edge
 	%.reg2mem.0 = phi i32 [ 0, %base2flt.exit.bb7.i197_crit_edge ], [ %.reg2mem.0, %bb10.i196.bb7.i197_crit_edge ], [ 0, %bb11.i.bb7.i197_crit_edge ]		; <i32> [#uses=1]
-	br i1 undef, label %bb10.i196.base2flt.exit204_crit_edge, label %bb10.i196
+	br i1 %arg, label %bb10.i196.base2flt.exit204_crit_edge, label %bb10.i196
 
 base2flt.exit204:		; preds = %bb10.i196.base2flt.exit204_crit_edge, %base2flt.exit.base2flt.exit204_crit_edge, %bb11.i.base2flt.exit204_crit_edge
 	br i1 false, label %base2flt.exit204.bb8_crit_edge, label %bb
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/extend-sink-hoist.ll b/llvm/test/Transforms/CodeGenPrepare/X86/extend-sink-hoist.ll
index 5349afc18d84de..5ddd0b9f4107c2 100644
--- a/llvm/test/Transforms/CodeGenPrepare/X86/extend-sink-hoist.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/X86/extend-sink-hoist.ll
@@ -45,11 +45,11 @@ block2:
 
 ; Make sure the cast sink logic and OptimizeExtUses don't end up in an infinite
 ; loop.
-define i128 @use_ext_source() {
+define i128 @use_ext_source(i1 %arg) {
 block1:
   %v1 = or i64 undef, undef
   %v2 = zext i64 %v1 to i128
-  br i1 undef, label %block2, label %block3
+  br i1 %arg, label %block2, label %block3
 
 block2:
   %v3 = add i64 %v1, 1
diff --git a/llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll b/llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll
index 69e84e942de65b..3577223c20e1ea 100644
--- a/llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll
+++ b/llvm/test/Transforms/ConstantHoisting/AArch64/consthoist-unreachable.ll
@@ -7,11 +7,11 @@
 
 @c.a = external global i32, align 1
 
-define void @c() {
+define void @c(i1 %arg) {
 ; CHECK-LABEL: @c(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[TOBOOL:%.*]] = icmp ne i16 0, 0
-; CHECK-NEXT:    br i1 undef, label [[LBL1_US:%.*]], label [[ENTRY_ENTRY_SPLIT_CRIT_EDGE:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LBL1_US:%.*]], label [[ENTRY_ENTRY_SPLIT_CRIT_EDGE:%.*]]
 ; CHECK:       entry.entry.split_crit_edge:
 ; CHECK-NEXT:    [[CONST:%.*]] = bitcast i32 1232131 to i32
 ; CHECK-NEXT:    br label [[LBL1:%.*]]
@@ -21,9 +21,9 @@ define void @c() {
 ; CHECK-NEXT:    br label [[FOR_COND4:%.*]]
 ; CHECK:       lbl1:
 ; CHECK-NEXT:    store i32 [[CONST]], ptr @c.a, align 1
-; CHECK-NEXT:    br i1 undef, label [[IF_THEN:%.*]], label [[FOR_END12:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[IF_THEN:%.*]], label [[FOR_END12:%.*]]
 ; CHECK:       if.then:
-; CHECK-NEXT:    br i1 undef, label [[LBL1]], label [[FOR_COND4]]
+; CHECK-NEXT:    br i1 %arg, label [[LBL1]], label [[FOR_COND4]]
 ; CHECK:       for.cond4:
 ; CHECK-NEXT:    br label [[FOR_COND4]]
 ; CHECK:       for.body9:
@@ -35,7 +35,7 @@ define void @c() {
 ;
 entry:
   %tobool = icmp ne i16 0, 0
-  br i1 undef, label %lbl1.us, label %entry.entry.split_crit_edge
+  br i1 %arg, label %lbl1.us, label %entry.entry.split_crit_edge
 
 entry.entry.split_crit_edge:                      ; preds = %entry
   br label %lbl1
@@ -46,10 +46,10 @@ lbl1.us:                                          ; preds = %entry
 
 lbl1:                                             ; preds = %if.then, %entry.entry.split_crit_edge
   store i32 1232131, ptr @c.a, align 1
-  br i1 undef, label %if.then, label %for.end12
+  br i1 %arg, label %if.then, label %for.end12
 
 if.then:                                          ; preds = %lbl1
-  br i1 undef, label %lbl1, label %for.cond4
+  br i1 %arg, label %lbl1, label %for.cond4
 
 for.cond4:                                        ; preds = %for.cond4, %if.then, %lbl1.us
   br label %for.cond4
diff --git a/llvm/test/Transforms/ConstantHoisting/ARM/same-offset-multi-types.ll b/llvm/test/Transforms/ConstantHoisting/ARM/same-offset-multi-types.ll
index 63447cb80c6d50..0a72b8895b09ac 100644
--- a/llvm/test/Transforms/ConstantHoisting/ARM/same-offset-multi-types.ll
+++ b/llvm/test/Transforms/ConstantHoisting/ARM/same-offset-multi-types.ll
@@ -26,9 +26,9 @@ target triple = "thumbv6m-none--musleabi"
 @global = external dso_local global %0, align 4
 
 ; Function Attrs: nounwind optsize ssp
-define dso_local void @zot() {
+define dso_local void @zot(i1 %arg) {
 bb:
-  br i1 undef, label %bb2, label %bb1
+  br i1 %arg, label %bb2, label %bb1
 
 bb1:                                              ; preds = %bb
   %tmp = load ptr, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 2, i32 0), align 4
diff --git a/llvm/test/Transforms/ConstantHoisting/PowerPC/masks.ll b/llvm/test/Transforms/ConstantHoisting/PowerPC/masks.ll
index 5787ff19753e58..45abdc4f6e9513 100644
--- a/llvm/test/Transforms/ConstantHoisting/PowerPC/masks.ll
+++ b/llvm/test/Transforms/ConstantHoisting/PowerPC/masks.ll
@@ -3,18 +3,18 @@ target datalayout = "E-m:e-i64:64-n32:64"
 target triple = "powerpc64-unknown-linux-gnu"
 
 ; Here the masks are all contiguous, and should not be hoisted.
-define i32 @test1() nounwind {
+define i32 @test1(i1 %arg) nounwind {
 entry:
 ; CHECK-LABEL:  @test1
 ; CHECK-NOT: bitcast i32 65535 to i32
 ; CHECK: and i32 undef, 65535
   %conv121 = and i32 undef, 65535
-  br i1 undef, label %if.then152, label %if.end167
+  br i1 %arg, label %if.then152, label %if.end167
 
 if.then152:
 ; CHECK: and i32 undef, 65535
   %conv153 = and i32 undef, 65535
-  br i1 undef, label %if.end167, label %end2
+  br i1 %arg, label %if.end167, label %end2
 
 if.end167:
 ; CHECK: and i32 {{.*}}, 32768
@@ -35,16 +35,16 @@ end2:
 }
 
 ; Here the masks are not contiguous, and should be hoisted.
-define i32 @test2() nounwind {
+define i32 @test2(i1 %arg) nounwind {
 entry:
 ; CHECK-LABEL: @test2
 ; CHECK: bitcast i32 65531 to i32
   %conv121 = and i32 undef, 65531
-  br i1 undef, label %if.then152, label %if.end167
+  br i1 %arg, label %if.then152, label %if.end167
 
 if.then152:
   %conv153 = and i32 undef, 65531
-  br i1 undef, label %if.end167, label %end2
+  br i1 %arg, label %if.end167, label %end2
 
 if.end167:
 ; CHECK: add i32 {{.*}}, -32758
diff --git a/llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll b/llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll
index 1fa27aabe35884..8c1b8b6834197e 100644
--- a/llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll
+++ b/llvm/test/Transforms/ConstantHoisting/X86/pr43903-not-all-uses-rebased.ll
@@ -8,12 +8,12 @@ target triple = "x86_64-unknown-linux-gnu"
 
 @a = external global [2 x i16], align 1
 
-define void @c() {
+define void @c(i1 %arg) {
 ; CHECK-LABEL: @c(
 ; CHECK-NEXT:  for.cond:
-; CHECK-NEXT:    br i1 undef, label [[FOR_BODY2:%.*]], label [[FOR_END4:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[FOR_BODY2:%.*]], label [[FOR_END4:%.*]]
 ; CHECK:       for.body2:
-; CHECK-NEXT:    br i1 undef, label [[LAND_RHS:%.*]], label [[LAND_END:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[LAND_RHS:%.*]], label [[LAND_END:%.*]]
 ; CHECK:       land.rhs:
 ; CHECK-NEXT:    unreachable
 ; CHECK:       land.end:
@@ -27,10 +27,10 @@ define void @c() {
 ; CHECK-NEXT:    ret void
 ;
 for.cond:
-  br i1 undef, label %for.body2, label %for.end4
+  br i1 %arg, label %for.body2, label %for.end4
 
 for.body2:                                        ; preds = %for.cond
-  br i1 undef, label %land.rhs, label %land.end
+  br i1 %arg, label %land.rhs, label %land.end
 
 land.rhs:                                         ; preds = %for.body2
   unreachable
diff --git a/llvm/test/Transforms/Coroutines/coro-async-remat.ll b/llvm/test/Transforms/Coroutines/coro-async-remat.ll
index fd2a35c0c7f881..808084ef3c8633 100644
--- a/llvm/test/Transforms/Coroutines/coro-async-remat.ll
+++ b/llvm/test/Transforms/Coroutines/coro-async-remat.ll
@@ -24,7 +24,7 @@ entry:
   ret ptr undef
 }
 
-define swifttailcc void @repo(ptr %0, ptr %1, ptr %arg, ptr %2) #1 {
+define swifttailcc void @repo(ptr %0, ptr %1, ptr %arg, ptr %2, i1 %arg2) #1 {
 entry:
   %swifterror = alloca swifterror ptr, align 8
   %3 = call token @llvm.coro.id.async(i32 20, i32 16, i32 1, ptr @repoTU)
@@ -33,10 +33,10 @@ entry:
   br label %6
 
 6:                                                ; preds = %21, %15, %entry
-  br i1 undef, label %7, label %23
+  br i1 %arg2, label %7, label %23
 
 7:                                                ; preds = %6
-  br i1 undef, label %8, label %16
+  br i1 %arg2, label %8, label %16
 
 8:                                                ; preds = %7
   %initializeWithTake35 = bitcast ptr undef to ptr
@@ -44,10 +44,10 @@ entry:
   %10 = call ptr @llvm.coro.async.resume()
   %11 = bitcast ptr %10 to ptr
   %12 = call { ptr, ptr } (i32, ptr, ptr, ...) @llvm.coro.suspend.async.sl_p0i8p0s_swift.error.4.220.413.429.445.461.672.683ss(i32 256, ptr %10, ptr @__swift_async_resume_project_context, ptr @__swift_suspend_dispatch_5.23, ptr undef, ptr undef, ptr undef, ptr %5, ptr undef, ptr undef)
-  br i1 undef, label %25, label %13
+  br i1 %arg2, label %25, label %13
 
 13:                                               ; preds = %8
-  br i1 undef, label %14, label %15
+  br i1 %arg2, label %14, label %15
 
 14:                                               ; preds = %13
   br label %24
@@ -56,16 +56,16 @@ entry:
   br label %6
 
 16:                                               ; preds = %7
-  br i1 undef, label %26, label %17
+  br i1 %arg2, label %26, label %17
 
 17:                                               ; preds = %16
-  br i1 undef, label %18, label %22
+  br i1 %arg2, label %18, label %22
 
 18:                                               ; preds = %17
-  br i1 undef, label %27, label %19
+  br i1 %arg2, label %27, label %19
 
 19:                                               ; preds = %18
-  br i1 undef, label %20, label %21
+  br i1 %arg2, label %20, label %21
 
 20:                                               ; preds = %19
   br label %24
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll b/llvm/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll
index fb2ca2b23bf4b9..52d95ddbd1d11f 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/2010-09-26-MergeConstantRange.ll
@@ -5,7 +5,7 @@
 @g_128 = external global %struct.S2, align 1
 @g_106 = external global i16, align 2
 
-define void @int328(i16 signext %p_82) noreturn nounwind ssp {
+define void @int328(i16 signext %p_82, i1 %arg) noreturn nounwind ssp {
 entry:
   %tobool3 = icmp eq i16 %p_82, 0
   br label %for.cond.outer
@@ -32,7 +32,7 @@ for.cond.split.us:                                ; preds = %for.cond
   br label %lbl_133.us
 
 lbl_133.us:                                       ; preds = %lbl_134.us, %for.cond.split.us
-  br i1 undef, label %if.else14.us-lcssa.us, label %if.then.us
+  br i1 %arg, label %if.else14.us-lcssa.us, label %if.then.us
 
 lbl_134.us:                                       ; preds = %if.then.us
   %cmp = icmp eq i16 ptrtoint (ptr @g_128 to i16), 0
@@ -66,7 +66,7 @@ for.cond9.preheader.us-lcssa:                     ; preds = %lbl_134
   br label %for.cond9.preheader
 
 for.cond9.preheader:                              ; preds = %for.cond9.preheader.us-lcssa, %for.cond9.preheader.us-lcssa.us
-  br i1 undef, label %bb.nph, label %for.cond.loopexit
+  br i1 %arg, label %bb.nph, label %for.cond.loopexit
 
 bb.nph:                                           ; preds = %for.cond9.preheader
   br label %for.cond.loopexit
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
index 3c3b1d4bef45bb..d7d93eba9c327e 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
@@ -1458,12 +1458,12 @@ entry:
   ret i1 %cmp
 }
 
-define i1 @srem_unknown(i32 %a) {
+define i1 @srem_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @srem_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[SREM:%.*]] = srem i32 [[A]], 30
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1473,19 +1473,19 @@ entry:
   %srem = srem i32 %a, 30
   %cmp1 = icmp slt i32 %srem, 30
   %cmp2 = icmp sgt i32 %srem, -30
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
   ret i1 %cmp2
 }
 
-define i1 @sdiv_unknown(i32 %a) {
+define i1 @sdiv_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @sdiv_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[SREM:%.*]] = sdiv i32 [[A]], 123
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1495,20 +1495,20 @@ entry:
   %srem = sdiv i32 %a, 123
   %cmp1 = icmp slt i32 %srem, 17459217
   %cmp2 = icmp sgt i32 %srem, -17459217
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
   ret i1 %cmp2
 }
 
-define i1 @uadd_sat_unknown(i32 %a) {
+define i1 @uadd_sat_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @uadd_sat_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[VAL:%.*]] = call i32 @llvm.uadd.sat.i32(i32 [[A]], i32 100)
 ; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i32 [[VAL]], 100
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1518,20 +1518,20 @@ entry:
   %val = call i32 @llvm.uadd.sat.i32(i32 %a, i32 100)
   %cmp1 = icmp uge i32 %val, 100
   %cmp2 = icmp ugt i32 %val, 100
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
   ret i1 %cmp2
 }
 
-define i1 @usub_sat_unknown(i32 %a) {
+define i1 @usub_sat_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @usub_sat_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[VAL:%.*]] = call i32 @llvm.usub.sat.i32(i32 [[A]], i32 100)
 ; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i32 [[VAL]], -101
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1541,20 +1541,20 @@ entry:
   %val = call i32 @llvm.usub.sat.i32(i32 %a, i32 100)
   %cmp1 = icmp ule i32 %val, 4294967195
   %cmp2 = icmp ult i32 %val, 4294967195
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
   ret i1 %cmp2
 }
 
-define i1 @sadd_sat_unknown(i32 %a) {
+define i1 @sadd_sat_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @sadd_sat_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[VAL:%.*]] = call i32 @llvm.sadd.sat.i32(i32 [[A]], i32 100)
 ; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i32 [[VAL]], -2147483548
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1564,20 +1564,20 @@ entry:
   %val = call i32 @llvm.sadd.sat.i32(i32 %a, i32 100)
   %cmp1 = icmp sge i32 %val, -2147483548
   %cmp2 = icmp sgt i32 %val, -2147483548
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
   ret i1 %cmp2
 }
 
-define i1 @ssub_sat_unknown(i32 %a) {
+define i1 @ssub_sat_unknown(i32 %a, i1 %arg) {
 ; CHECK-LABEL: define i1 @ssub_sat_unknown
-; CHECK-SAME: (i32 [[A:%.*]]) {
+; CHECK-SAME: (i32 [[A:%.*]], i1 [[ARG:%.*]]) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[VAL:%.*]] = call i32 @llvm.ssub.sat.i32(i32 [[A]], i32 100)
 ; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i32 [[VAL]], 2147483547
-; CHECK-NEXT:    br i1 undef, label [[EXIT1:%.*]], label [[EXIT2:%.*]]
+; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT1:%.*]], label [[EXIT2:%.*]]
 ; CHECK:       exit1:
 ; CHECK-NEXT:    ret i1 true
 ; CHECK:       exit2:
@@ -1587,7 +1587,7 @@ entry:
   %val = call i32 @llvm.ssub.sat.i32(i32 %a, i32 100)
   %cmp1 = icmp sle i32 %val, 2147483547
   %cmp2 = icmp slt i32 %val, 2147483547
-  br i1 undef, label %exit1, label %exit2
+  br i1 %arg, label %exit1, label %exit2
 exit1:
   ret i1 %cmp1
 exit2:
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/crash.ll b/llvm/test/Transforms/CorrelatedValuePropagation/crash.ll
index 8a7a4afb894f45..031cc0e9bb3ae1 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/crash.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/crash.ll
@@ -37,13 +37,13 @@ func_29.exit:
 }
 
 ; PR13972
-define void @test3() nounwind {
+define void @test3(i1 %arg) nounwind {
 for.body:
   br label %return
 
 for.cond.i:                                       ; preds = %if.else.i, %for.body.i
   %e.2.i = phi i32 [ %e.2.i, %if.else.i ], [ -8, %for.body.i ]
-  br i1 undef, label %return, label %for.body.i
+  br i1 %arg, label %return, label %for.body.i
 
 for.body.i:                                       ; preds = %for.cond.i
   switch i32 %e.2.i, label %for.cond3.i [
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/pr35807.ll b/llvm/test/Transforms/CorrelatedValuePropagation/pr35807.ll
index c1898569b8b070..a5b6ff6a759421 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/pr35807.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/pr35807.ll
@@ -3,13 +3,13 @@
 
 target triple = "x86_64-apple-darwin17.4.0"
 
-define void @patatino() {
+define void @patatino(i1 %arg) {
 ; CHECK-LABEL: @patatino(
-; CHECK-NEXT:    br i1 undef, label [[BB3:%.*]], label [[BB4:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB3:%.*]], label [[BB4:%.*]]
 ; CHECK:       bb3:
 ; CHECK-NEXT:    br label [[BB3]]
 ; CHECK:       bb4:
-; CHECK-NEXT:    br i1 undef, label [[BB40:%.*]], label [[BB22:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB40:%.*]], label [[BB22:%.*]]
 ; CHECK:       bb7:
 ; CHECK-NEXT:    br label [[BB14:%.*]]
 ; CHECK:       bb12:
@@ -17,24 +17,24 @@ define void @patatino() {
 ; CHECK:       bb14:
 ; CHECK-NEXT:    [[TMP19:%.*]] = icmp sgt i32 undef, undef
 ; CHECK-NEXT:    [[TMP20:%.*]] = select i1 [[TMP19]], i64 [[TMP20]], i64 0
-; CHECK-NEXT:    br i1 undef, label [[BB40]], label [[BB7:%.*]]
+; CHECK-NEXT:    br i1 %arg, label [[BB40]], label [[BB7:%.*]]
 ; CHECK:       bb22:
 ; CHECK-NEXT:    br label [[BB24:%.*]]
 ; CHECK:       bb24:
 ; CHECK-NEXT:    br label [[BB32:%.*]]
 ; CHECK:       bb32:
-; CHECK-NEXT:    br i1 undef, label [[BB40]], label [[BB24]]
+; CHECK-NEXT:    br i1 %arg, label [[BB40]], label [[BB24]]
 ; CHECK:       bb40:
 ; CHECK-NEXT:    [[TMP41:%.*]] = phi i64 [ 4, [[BB4]] ], [ [[TMP20]], [[BB14]] ], [ undef, [[BB32]] ]
 ; CHECK-NEXT:    ret void
 ;
-  br i1 undef, label %bb3, label %bb4
+  br i1 %arg, label %bb3, label %bb4
 
 bb3:
   br label %bb3
 
 bb4:
-  br i1 undef, label %bb40, label %bb22
+  br i1 %arg, label %bb40, label %bb22
 
 bb7...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/115691


More information about the llvm-commits mailing list