[llvm] [llvm] Remove `br i1 undef` from regression tests (PR #115691)
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 00:12:46 PST 2024
https://github.com/nunoplopes updated https://github.com/llvm/llvm-project/pull/115691
>From 14e50754745f9f01f5ec3dd277a9fda9cdd3c952 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Sun, 10 Nov 2024 23:18:27 -0700
Subject: [PATCH] Remove br i1 undef
---
.../X86/2008-11-24-RAUW-Self.ll | 4 +-
.../CodeGenPrepare/X86/extend-sink-hoist.ll | 4 +-
.../AArch64/consthoist-unreachable.ll | 14 +++---
.../ARM/same-offset-multi-types.ll | 4 +-
.../ConstantHoisting/PowerPC/masks.ll | 12 ++---
.../X86/pr43903-not-all-uses-rebased.ll | 10 ++--
.../Transforms/Coroutines/coro-async-remat.ll | 18 +++----
.../2010-09-26-MergeConstantRange.ll | 6 +--
.../CorrelatedValuePropagation/basic.ll | 48 +++++++++----------
.../CorrelatedValuePropagation/crash.ll | 4 +-
.../CorrelatedValuePropagation/pr35807.ll | 18 +++----
.../DeadStoreElimination/overlap.ll | 6 +--
.../Transforms/DeadStoreElimination/simple.ll | 6 +--
.../EarlyCSE/X86/preserve_memoryssa.ll | 6 +--
.../Transforms/FixIrreducible/bug45623.ll | 27 ++++++-----
.../Transforms/FixIrreducible/unreachable.ll | 4 +-
llvm/test/Transforms/FunctionAttrs/nonnull.ll | 9 ++--
.../bug55000-read-uninitialized-value.ll | 12 ++---
llvm/test/Transforms/IRCE/pr57335.ll | 4 +-
19 files changed, 109 insertions(+), 107 deletions(-)
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:
br label %bb14
@@ -49,7 +49,7 @@ bb12:
bb14:
%tmp19 = icmp sgt i32 undef, undef
%tmp20 = select i1 %tmp19, i64 %tmp20, i64 0
- br i1 undef, label %bb40, label %bb7
+ br i1 %arg, label %bb40, label %bb7
bb22:
br label %bb24
@@ -58,7 +58,7 @@ bb24:
br label %bb32
bb32:
- br i1 undef, label %bb40, label %bb24
+ br i1 %arg, label %bb40, label %bb24
bb40:
%tmp41 = phi i64 [ 4, %bb4 ], [ %tmp20, %bb14 ], [ undef, %bb32 ]
diff --git a/llvm/test/Transforms/DeadStoreElimination/overlap.ll b/llvm/test/Transforms/DeadStoreElimination/overlap.ll
index d1dedbf5a95237..88271db224e597 100644
--- a/llvm/test/Transforms/DeadStoreElimination/overlap.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/overlap.ll
@@ -29,14 +29,14 @@ define void @test1() {
ret void
}
-define void @test2() {
+define void @test2(i1 %arg) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: [[A:%.*]] = alloca i64, align 8
; CHECK-NEXT: call void @use(ptr [[A]])
; CHECK-NEXT: [[PTR2:%.*]] = getelementptr i8, ptr [[A]], i32 1
; CHECK-NEXT: store i8 10, ptr [[A]], align 1
; CHECK-NEXT: store i8 20, ptr [[PTR2]], align 1
-; CHECK-NEXT: br i1 undef, label [[BB1:%.*]], label [[END:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[BB1:%.*]], label [[END:%.*]]
; CHECK: bb1:
; CHECK-NEXT: [[LV:%.*]] = load i64, ptr [[A]], align 4
; CHECK-NEXT: br label [[END]]
@@ -51,7 +51,7 @@ define void @test2() {
store i8 10, ptr %a
store i8 20, ptr %ptr2
- br i1 undef, label %bb1, label %end
+ br i1 %arg, label %bb1, label %end
bb1:
%lv = load i64, ptr %a
diff --git a/llvm/test/Transforms/DeadStoreElimination/simple.ll b/llvm/test/Transforms/DeadStoreElimination/simple.ll
index ef2c4ef564b24a..af5b77c79acdc6 100644
--- a/llvm/test/Transforms/DeadStoreElimination/simple.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/simple.ll
@@ -476,7 +476,7 @@ bb3:
}
; Don't remove redundant store in a loop with a may-alias store.
-define i32 @test32(i1 %c, ptr %p, i32 %i) {
+define i32 @test32(i1 %c, ptr %p, i32 %i, i1 %arg) {
; CHECK-LABEL: @test32(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[P:%.*]], align 4
@@ -484,7 +484,7 @@ define i32 @test32(i1 %c, ptr %p, i32 %i) {
; CHECK: bb1:
; CHECK-NEXT: store i32 [[V]], ptr [[P]], align 4
; CHECK-NEXT: call void @unknown_func()
-; CHECK-NEXT: br i1 undef, label [[BB1]], label [[BB2:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[BB1]], label [[BB2:%.*]]
; CHECK: bb2:
; CHECK-NEXT: ret i32 0
;
@@ -495,7 +495,7 @@ bb1:
store i32 %v, ptr %p, align 4
; Might read and overwrite value at %p
call void @unknown_func()
- br i1 undef, label %bb1, label %bb2
+ br i1 %arg, label %bb1, label %bb2
bb2:
ret i32 0
}
diff --git a/llvm/test/Transforms/EarlyCSE/X86/preserve_memoryssa.ll b/llvm/test/Transforms/EarlyCSE/X86/preserve_memoryssa.ll
index dcaa0b5b399af6..cadb61043c72ab 100644
--- a/llvm/test/Transforms/EarlyCSE/X86/preserve_memoryssa.ll
+++ b/llvm/test/Transforms/EarlyCSE/X86/preserve_memoryssa.ll
@@ -89,10 +89,10 @@ entry:
%struct.gnode.0.1.3.6.9.18.20.79 = type { i32, i32, i32, i32, i32, i32, i32, ptr }
@gnodeArray = external global ptr, align 8
-define void @test4_shortest() {
+define void @test4_shortest(i1 %arg) {
entry:
%exl.i = alloca [5 x i32], align 16
- br i1 undef, label %if.then274, label %for.cond404
+ br i1 %arg, label %if.then274, label %for.cond404
if.then274: ; preds = %if.end256
%arrayidx.i = getelementptr inbounds [5 x i32], ptr %exl.i, i64 0, i64 1
@@ -118,7 +118,7 @@ for.cond404: ; preds = %if.end256
%arrayidx6.i968 = getelementptr inbounds ptr, ptr %0, i64 undef
; MemoryUse(1) MayAlias
%1 = load ptr, ptr %arrayidx6.i968, align 8
- br i1 undef, label %for.cond26.preheader.i974, label %if.then20.for.body_crit_edge.i999
+ br i1 %arg, label %for.cond26.preheader.i974, label %if.then20.for.body_crit_edge.i999
for.cond26.preheader.i974: ; preds = %if.then20.i996
%arrayidx.i924 = getelementptr inbounds [5 x i32], ptr %exl.i, i64 0, i64 1
diff --git a/llvm/test/Transforms/FixIrreducible/bug45623.ll b/llvm/test/Transforms/FixIrreducible/bug45623.ll
index beddc967ebb0b6..58724431ff0ee1 100644
--- a/llvm/test/Transforms/FixIrreducible/bug45623.ll
+++ b/llvm/test/Transforms/FixIrreducible/bug45623.ll
@@ -3,34 +3,35 @@
; RUN: opt < %s -passes='fix-irreducible,verify<loops>' -S | FileCheck %s
; RUN: opt < %s -passes='verify<loops>,fix-irreducible,verify<loops>' -S | FileCheck %s
-define dso_local void @tre_tnfa_run_backtrack() {
+define dso_local void @tre_tnfa_run_backtrack(i1 %arg) {
; CHECK-LABEL: @tre_tnfa_run_backtrack(
; CHECK-NEXT: entry:
+; CHECK-NEXT: [[ARG_INV:%.*]] = xor i1 [[ARG:%.*]], true
; CHECK-NEXT: br label [[RETRY:%.*]]
; CHECK: retry:
; CHECK-NEXT: br label [[IRR_GUARD:%.*]]
; CHECK: while.body248:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN250:%.*]], label [[IF_END275:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN250:%.*]], label [[IF_END275:%.*]]
; CHECK: if.then250:
; CHECK-NEXT: br label [[FOR_COND264:%.*]]
; CHECK: for.cond264:
-; CHECK-NEXT: br i1 undef, label [[FOR_BODY267:%.*]], label [[BACKTRACK:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY267:%.*]], label [[BACKTRACK:%.*]]
; CHECK: for.body267:
; CHECK-NEXT: br label [[FOR_COND264]]
; CHECK: if.end275:
; CHECK-NEXT: br label [[FOR_COND342:%.*]]
; CHECK: for.cond342:
-; CHECK-NEXT: br i1 undef, label [[FOR_BODY345:%.*]], label [[FOR_END580:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY345:%.*]], label [[FOR_END580:%.*]]
; CHECK: for.body345:
; CHECK-NEXT: br label [[FOR_COND342]]
; CHECK: for.end580:
; CHECK-NEXT: br label [[BACKTRACK]]
; CHECK: backtrack:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN595:%.*]], label [[IF_ELSE629:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN595:%.*]], label [[IF_ELSE629:%.*]]
; CHECK: if.then595:
; CHECK-NEXT: br label [[FOR_COND616:%.*]]
; CHECK: for.cond616:
-; CHECK-NEXT: br i1 undef, label [[FOR_BODY619:%.*]], label [[FOR_END626:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY619:%.*]], label [[FOR_END626:%.*]]
; CHECK: for.body619:
; CHECK-NEXT: br label [[FOR_COND616]]
; CHECK: for.end626:
@@ -38,23 +39,23 @@ define dso_local void @tre_tnfa_run_backtrack() {
; CHECK: if.else629:
; CHECK-NEXT: br label [[RETRY]]
; CHECK: irr.guard:
-; CHECK-NEXT: [[GUARD_WHILE_BODY248:%.*]] = phi i1 [ true, [[FOR_END626]] ], [ undef, [[RETRY]] ]
+; CHECK-NEXT: [[GUARD_WHILE_BODY248:%.*]] = phi i1 [ true, [[FOR_END626]] ], [ [[ARG_INV]], [[RETRY]] ]
; CHECK-NEXT: br i1 [[GUARD_WHILE_BODY248]], label [[WHILE_BODY248:%.*]], label [[BACKTRACK]]
;
entry:
br label %retry
retry:
- br i1 undef, label %backtrack, label %while.body248
+ br i1 %arg, label %backtrack, label %while.body248
while.body248: ; preds = %for.end626, %retry
- br i1 undef, label %if.then250, label %if.end275
+ br i1 %arg, label %if.then250, label %if.end275
if.then250: ; preds = %while.body248
br label %for.cond264
for.cond264: ; preds = %for.body267, %if.then250
- br i1 undef, label %for.body267, label %backtrack
+ br i1 %arg, label %for.body267, label %backtrack
for.body267: ; preds = %for.cond264
br label %for.cond264
@@ -63,7 +64,7 @@ if.end275: ; preds = %while.body248
br label %for.cond342
for.cond342: ; preds = %for.body345, %if.end275
- br i1 undef, label %for.body345, label %for.end580
+ br i1 %arg, label %for.body345, label %for.end580
for.body345: ; preds = %for.cond342
br label %for.cond342
@@ -72,13 +73,13 @@ for.end580: ; preds = %for.cond342
br label %backtrack
backtrack: ; preds = %for.end580, %for.cond264, %retry
- br i1 undef, label %if.then595, label %if.else629
+ br i1 %arg, label %if.then595, label %if.else629
if.then595: ; preds = %backtrack
br label %for.cond616
for.cond616: ; preds = %for.body619, %if.then595
- br i1 undef, label %for.body619, label %for.end626
+ br i1 %arg, label %for.body619, label %for.end626
for.body619: ; preds = %for.cond616
br label %for.cond616
diff --git a/llvm/test/Transforms/FixIrreducible/unreachable.ll b/llvm/test/Transforms/FixIrreducible/unreachable.ll
index cc9a29b2a8d711..defbefb3ba8121 100644
--- a/llvm/test/Transforms/FixIrreducible/unreachable.ll
+++ b/llvm/test/Transforms/FixIrreducible/unreachable.ll
@@ -6,7 +6,7 @@
; CHECK-LABEL: @unreachable(
; CHECK: entry:
; CHECK-NOT: irr.guard:
-define void @unreachable(i32 %n) {
+define void @unreachable(i32 %n, i1 %arg) {
entry:
br label %loop.body
@@ -17,7 +17,7 @@ unreachable.block:
br label %inner.block
inner.block:
- br i1 undef, label %loop.exit, label %loop.latch
+ br i1 %arg, label %loop.exit, label %loop.latch
loop.latch:
br label %loop.body
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index 05c8bdaf66e7aa..6dd2399093b668 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -148,14 +148,15 @@ define ptr @test5(i1 %c) {
}
; Local analysis, but going through a self recursive phi
-define ptr @test6a() {
-; COMMON-LABEL: define nonnull ptr @test6a() {
+define ptr @test6a(i1 %arg) {
+; COMMON-LABEL: define nonnull ptr @test6a(
+; COMMON-SAME: i1 [[ARG:%.*]]) {
; COMMON-NEXT: entry:
; COMMON-NEXT: [[RET:%.*]] = call ptr @ret_nonnull()
; COMMON-NEXT: br label [[LOOP:%.*]]
; COMMON: loop:
; COMMON-NEXT: [[PHI:%.*]] = phi ptr [ [[RET]], [[ENTRY:%.*]] ], [ [[PHI]], [[LOOP]] ]
-; COMMON-NEXT: br i1 undef, label [[LOOP]], label [[EXIT:%.*]]
+; COMMON-NEXT: br i1 [[ARG]], label [[LOOP]], label [[EXIT:%.*]]
; COMMON: exit:
; COMMON-NEXT: ret ptr [[PHI]]
;
@@ -164,7 +165,7 @@ entry:
br label %loop
loop:
%phi = phi ptr [%ret, %entry], [%phi, %loop]
- br i1 undef, label %loop, label %exit
+ br i1 %arg, label %loop, label %exit
exit:
ret ptr %phi
}
diff --git a/llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll b/llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll
index d96460efe34620..a2fd239c9ce305 100644
--- a/llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll
+++ b/llvm/test/Transforms/FunctionSpecialization/bug55000-read-uninitialized-value.ll
@@ -7,7 +7,7 @@ declare hidden { i8, ptr } @getType(ptr) align 2
; CHECK-LABEL: @foo.specialized.1
; CHECK-LABEL: @foo.specialized.2
-define internal void @foo(ptr %TLI, ptr %DL, ptr %Ty, ptr %ValueVTs, ptr %Offsets, i64 %StartingOffset) {
+define internal void @foo(ptr %TLI, ptr %DL, ptr %Ty, ptr %ValueVTs, ptr %Offsets, i64 %StartingOffset, i1 %arg) {
entry:
%VT = alloca i64, align 8
br i1 false, label %if.then, label %if.end4
@@ -21,7 +21,7 @@ if.end4: ; preds = %entry
for.body: ; preds = %if.end4
%add13 = add i64 %StartingOffset, undef
- call void @foo(ptr %TLI, ptr %DL, ptr undef, ptr %ValueVTs, ptr %Offsets, i64 %add13)
+ call void @foo(ptr %TLI, ptr %DL, ptr undef, ptr %ValueVTs, ptr %Offsets, i64 %add13, i1 %arg)
unreachable
for.cond16: ; preds = %for.cond34, %if.end4
@@ -29,14 +29,14 @@ for.cond16: ; preds = %for.cond34, %if.end
br label %for.cond34
for.cond34: ; preds = %for.body37, %for.cond16
- br i1 undef, label %for.body37, label %for.cond16
+ br i1 %arg, label %for.body37, label %for.cond16
for.body37: ; preds = %for.cond34
%tobool39 = icmp ne ptr %Offsets, null
br label %for.cond34
}
-define hidden { ptr, i32 } @bar(ptr %this) {
+define hidden { ptr, i32 } @bar(ptr %this, i1 %arg) {
entry:
%Offsets = alloca i64, align 8
%cmp26 = call zeroext i1 @compare(ptr undef)
@@ -50,11 +50,11 @@ for.body28: ; preds = %entry
br i1 %call33, label %if.then34, label %if.end106
if.then34: ; preds = %for.body28
- call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr null, i64 0)
+ call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr null, i64 0, i1 %arg)
unreachable
if.end106: ; preds = %for.body28
- call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr %Offsets, i64 0)
+ call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr %Offsets, i64 0, i1 %arg)
unreachable
}
diff --git a/llvm/test/Transforms/IRCE/pr57335.ll b/llvm/test/Transforms/IRCE/pr57335.ll
index dbc61e0e9a255e..eb9fc129b93a33 100644
--- a/llvm/test/Transforms/IRCE/pr57335.ll
+++ b/llvm/test/Transforms/IRCE/pr57335.ll
@@ -2,7 +2,7 @@
; RUN: opt -passes='require<branch-prob>,irce' -S < %s 2>&1 | FileCheck %s
; Make sure we don't crash.
-define void @test() {
+define void @test(i1 %arg) {
; CHECK-LABEL: test
bb:
%tmp = icmp ult i32 0, undef
@@ -41,7 +41,7 @@ bb17: ; preds = %bb12
bb20: ; preds = %bb17
%tmp21 = add nuw nsw i32 %tmp7, 2
- br i1 undef, label %bb22, label %bb2
+ br i1 %arg, label %bb22, label %bb2
bb22: ; preds = %bb20
%tmp23 = phi i32 [ %tmp18, %bb20 ]
More information about the llvm-commits
mailing list