[llvm] [llvm] Remove `br i1 undef` from regression tests (PR #116161)
Lee Wei via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 14:36:39 PST 2024
https://github.com/leewei05 updated https://github.com/llvm/llvm-project/pull/116161
>From 2464846fcf7cea2592243c2efd07320f2780adec Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 11 Nov 2024 22:55:24 -0700
Subject: [PATCH 1/6] Remove br i1 undef in HotColdSplit directory
---
.../HotColdSplit/X86/do-not-split.ll | 44 +++++++++----------
.../Transforms/HotColdSplit/addr-taken.ll | 4 +-
.../HotColdSplit/apply-noreturn-bonus.ll | 6 +--
.../HotColdSplit/apply-penalty-for-inputs.ll | 8 ++--
.../HotColdSplit/apply-penalty-for-outputs.ll | 4 +-
.../Transforms/HotColdSplit/eh-typeid-for.ll | 4 +-
.../forward-dfs-reaches-marked-block.ll | 6 +--
.../lifetime-markers-on-inputs-2.ll | 34 +++++++-------
.../lifetime-markers-on-inputs-3.ll | 4 +-
llvm/test/Transforms/HotColdSplit/minsize.ll | 4 +-
.../HotColdSplit/outline-cold-asm.ll | 4 +-
.../HotColdSplit/outline-disjoint-diamonds.ll | 10 ++---
.../phi-with-distinct-outlined-values.ll | 4 +-
.../HotColdSplit/section-splitting-custom.ll | 6 +--
.../HotColdSplit/section-splitting-default.ll | 6 +--
.../Transforms/HotColdSplit/split-cold-2.ll | 6 +--
.../HotColdSplit/succ-block-with-self-edge.ll | 16 +++----
.../Transforms/HotColdSplit/swifterror.ll | 8 ++--
18 files changed, 89 insertions(+), 89 deletions(-)
diff --git a/llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll b/llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
index d343351c57db8e..d7c87567108c90 100644
--- a/llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
+++ b/llvm/test/Transforms/HotColdSplit/X86/do-not-split.ll
@@ -9,9 +9,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; The cold region is too small to split.
; CHECK-LABEL: @foo
; CHECK-NOT: foo.cold.1
-define void @foo() {
+define void @foo(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
unreachable
@@ -23,9 +23,9 @@ if.end: ; preds = %entry
; The cold region is still too small to split.
; CHECK-LABEL: @bar
; CHECK-NOT: bar.cold.1
-define void @bar() {
+define void @bar(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -38,9 +38,9 @@ if.end: ; preds = %entry
; Make sure we don't try to outline the entire function.
; CHECK-LABEL: @fun
; CHECK-NOT: fun.cold.1
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -63,9 +63,9 @@ entry:
; Do not split `noinline` functions.
; CHECK-LABEL: @noinline_func
; CHECK-NOT: noinline_func.cold.1
-define void @noinline_func() noinline {
+define void @noinline_func(i1 %arg) noinline {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -78,9 +78,9 @@ if.end: ; preds = %entry
; Do not split `alwaysinline` functions.
; CHECK-LABEL: @alwaysinline_func
; CHECK-NOT: alwaysinline_func.cold.1
-define void @alwaysinline_func() alwaysinline {
+define void @alwaysinline_func(i1 %arg) alwaysinline {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -105,10 +105,10 @@ loop:
; Don't count debug intrinsics towards the outlining threshold.
; CHECK-LABEL: @dont_count_debug_intrinsics
; CHECK-NOT: dont_count_debug_intrinsics.cold.1
-define void @dont_count_debug_intrinsics(i32 %arg1) !dbg !6 {
+define void @dont_count_debug_intrinsics(i32 %arg1, i1 %arg) !dbg !6 {
entry:
%var = add i32 0, 0, !dbg !11
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
ret void
@@ -122,9 +122,9 @@ if.end: ; preds = %entry
; CHECK-LABEL: @sanitize_address
; CHECK-NOT: sanitize_address.cold.1
-define void @sanitize_address() sanitize_address {
+define void @sanitize_address(i1 %arg) sanitize_address {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -136,9 +136,9 @@ if.end: ; preds = %entry
; CHECK-LABEL: @sanitize_hwaddress
; CHECK-NOT: sanitize_hwaddress.cold.1
-define void @sanitize_hwaddress() sanitize_hwaddress {
+define void @sanitize_hwaddress(i1 %arg) sanitize_hwaddress {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -150,9 +150,9 @@ if.end: ; preds = %entry
; CHECK-LABEL: @sanitize_thread
; CHECK-NOT: sanitize_thread.cold.1
-define void @sanitize_thread() sanitize_thread {
+define void @sanitize_thread(i1 %arg) sanitize_thread {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -164,9 +164,9 @@ if.end: ; preds = %entry
; CHECK-LABEL: @sanitize_memory
; CHECK-NOT: sanitize_memory.cold.1
-define void @sanitize_memory() sanitize_memory {
+define void @sanitize_memory(i1 %arg) sanitize_memory {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @sink()
@@ -180,9 +180,9 @@ declare void @llvm.trap() cold noreturn
; CHECK-LABEL: @nosanitize_call
; CHECK-NOT: nosanitize_call.cold.1
-define void @nosanitize_call() sanitize_memory {
+define void @nosanitize_call(i1 %arg) sanitize_memory {
entry:
- br i1 undef, label %if.then, label %if.end
+ br i1 %arg, label %if.then, label %if.end
if.then: ; preds = %entry
call void @llvm.trap(), !nosanitize !2
diff --git a/llvm/test/Transforms/HotColdSplit/addr-taken.ll b/llvm/test/Transforms/HotColdSplit/addr-taken.ll
index 5a33af55e7b4a4..f2fe953ff719de 100644
--- a/llvm/test/Transforms/HotColdSplit/addr-taken.ll
+++ b/llvm/test/Transforms/HotColdSplit/addr-taken.ll
@@ -9,8 +9,8 @@ define void @foo() noreturn cold {
}
; CHECK: define {{.*}} @bar.cold.1{{.*}}#[[outlined_func_attr]]
-define void @bar() {
- br i1 undef, label %normal, label %exit
+define void @bar(i1 %arg) {
+ br i1 %arg, label %normal, label %exit
normal:
unreachable
diff --git a/llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll b/llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
index b9666deae118a0..cefccd71d8a216 100644
--- a/llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
+++ b/llvm/test/Transforms/HotColdSplit/apply-noreturn-bonus.ll
@@ -3,14 +3,14 @@
declare void @sink() cold
-define void @foo(i32 %arg) {
+define void @foo(i32 %arg, i1 %arg2) {
entry:
- br i1 undef, label %cold1, label %exit
+ br i1 %arg2, label %cold1, label %exit
cold1:
; CHECK: Applying bonus for: 4 non-returning terminators
call void @sink()
- br i1 undef, label %cold2, label %cold3
+ br i1 %arg2, label %cold2, label %cold3
cold2:
br label %cold4
diff --git a/llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll b/llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
index 34b74d17398203..48f965440882d2 100644
--- a/llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
+++ b/llvm/test/Transforms/HotColdSplit/apply-penalty-for-inputs.ll
@@ -5,9 +5,9 @@ declare void @sink(ptr, i32, i32) cold
@g = global i32 0
-define void @foo(i32 %arg) {
+define void @foo(i32 %arg, i1 %arg2) {
%local = load i32, ptr @g
- br i1 undef, label %cold, label %exit
+ br i1 %arg2, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
@@ -21,8 +21,8 @@ exit:
ret void
}
-define void @bar(ptr %p1, i32 %p2, i32 %p3) {
- br i1 undef, label %cold, label %exit
+define void @bar(ptr %p1, i32 %p2, i32 %p3, i1 %arg) {
+ br i1 %arg, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
diff --git a/llvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll b/llvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll
index 9575cbff3a6195..96d73088e7874c 100644
--- a/llvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll
+++ b/llvm/test/Transforms/HotColdSplit/apply-penalty-for-outputs.ll
@@ -5,9 +5,9 @@ declare void @sink() cold
@g = global i32 0
-define i32 @foo(i32 %arg) {
+define i32 @foo(i32 %arg, i1 %arg2) {
entry:
- br i1 undef, label %cold, label %exit
+ br i1 %arg2, label %cold, label %exit
cold:
; CHECK: Applying penalty for splitting: 2
diff --git a/llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll b/llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
index a2ed286f36434b..e5f06c552ca83f 100644
--- a/llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
+++ b/llvm/test/Transforms/HotColdSplit/eh-typeid-for.ll
@@ -6,9 +6,9 @@
; CHECK-LABEL: @fun
; CHECK-NOT: call {{.*}}@fun.cold.1
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
diff --git a/llvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll b/llvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
index 57aea5d1b3ec4a..013957f0a64da7 100644
--- a/llvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
+++ b/llvm/test/Transforms/HotColdSplit/forward-dfs-reaches-marked-block.ll
@@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: define {{.*}}@fun
; CHECK: call {{.*}}@fun.cold.1(
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
; This will be marked by the inverse DFS on sink-predecesors.
@@ -17,7 +17,7 @@ sink:
call void @sink()
; Do not allow the forward-DFS on sink-successors to mark the block again.
- br i1 undef, label %if.then, label %if.then.exit
+ br i1 %arg, label %if.then, label %if.then.exit
if.then.exit:
ret void
diff --git a/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll b/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
index 8d99c80546ad9e..e42db78c195bcb 100644
--- a/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
+++ b/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-2.ll
@@ -34,14 +34,14 @@ declare void @use(ptr)
; \ /
; exit
; (lt.end)
-define void @only_lifetime_start_is_cold() {
+define void @only_lifetime_start_is_cold(i1 %arg) {
; CHECK-LABEL: @only_lifetime_start_is_cold(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
-; CHECK-NEXT: br i1 undef, label [[CODEREPL:%.*]], label [[NO_EXTRACT1:%.*]]
+; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[CODEREPL:%.*]], label [[NO_EXTRACT1:%.*]]
; CHECK: codeRepl:
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 -1, ptr [[LOCAL1]])
-; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @only_lifetime_start_is_cold.cold.1(ptr [[LOCAL1]]) #3
+; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @only_lifetime_start_is_cold.cold.1(ptr [[LOCAL1]], i1 [[ARG]]) #[[ATTR3:[0-9]+]]
; CHECK-NEXT: br i1 [[TARGETBLOCK]], label [[NO_EXTRACT1]], label [[EXIT:%.*]]
; CHECK: no-extract1:
; CHECK-NEXT: br label [[EXIT]]
@@ -51,13 +51,13 @@ define void @only_lifetime_start_is_cold() {
;
entry:
%local1 = alloca i256
- br i1 undef, label %extract1, label %no-extract1
+ br i1 %arg, label %extract1, label %no-extract1
extract1:
; lt.start
call void @llvm.lifetime.start.p0(i64 1, ptr %local1)
call void @cold_use(ptr %local1)
- br i1 undef, label %extract2, label %no-extract1
+ br i1 %arg, label %extract2, label %no-extract1
extract2:
br label %exit
@@ -92,17 +92,17 @@ exit:
; (lt.end)
; \ /
; exit
-define void @only_lifetime_end_is_cold() {
+define void @only_lifetime_end_is_cold(i1 %arg) {
; CHECK-LABEL: @only_lifetime_end_is_cold(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
+; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[LOCAL1]])
-; CHECK-NEXT: br i1 undef, label [[NO_EXTRACT1:%.*]], label [[CODEREPL:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[NO_EXTRACT1:%.*]], label [[CODEREPL:%.*]]
; CHECK: no-extract1:
; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[LOCAL1]])
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: codeRepl:
-; CHECK-NEXT: call void @only_lifetime_end_is_cold.cold.1(ptr [[LOCAL1]]) #3
+; CHECK-NEXT: call void @only_lifetime_end_is_cold.cold.1(ptr [[LOCAL1]]) #[[ATTR3]]
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
@@ -111,7 +111,7 @@ entry:
; lt.start
%local1 = alloca i256
call void @llvm.lifetime.start.p0(i64 1, ptr %local1)
- br i1 undef, label %no-extract1, label %extract1
+ br i1 %arg, label %no-extract1, label %extract1
no-extract1:
; lt.end
@@ -130,17 +130,17 @@ exit:
; In this CFG, splitting will extract the blocks extract{1,2,3}. Lifting the
; lifetime.end marker would be a miscompile.
-define void @do_not_lift_lifetime_end() {
+define void @do_not_lift_lifetime_end(i1 %arg) {
; CHECK-LABEL: @do_not_lift_lifetime_end(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256
+; CHECK-NEXT: [[LOCAL1:%.*]] = alloca i256, align 8
; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 1, ptr [[LOCAL1]])
; CHECK-NEXT: br label [[HEADER:%.*]]
; CHECK: header:
; CHECK-NEXT: call void @use(ptr [[LOCAL1]])
-; CHECK-NEXT: br i1 undef, label [[EXIT:%.*]], label [[CODEREPL:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[EXIT:%.*]], label [[CODEREPL:%.*]]
; CHECK: codeRepl:
-; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @do_not_lift_lifetime_end.cold.1(ptr [[LOCAL1]]) #3
+; CHECK-NEXT: [[TARGETBLOCK:%.*]] = call i1 @do_not_lift_lifetime_end.cold.1(ptr [[LOCAL1]], i1 [[ARG]]) #[[ATTR3]]
; CHECK-NEXT: br i1 [[TARGETBLOCK]], label [[HEADER]], label [[EXIT]]
; CHECK: exit:
; CHECK-NEXT: ret void
@@ -155,11 +155,11 @@ header:
; If the lifetime.end marker is lifted, this use becomes dead the second time
; the header block is executed.
call void @use(ptr %local1)
- br i1 undef, label %exit, label %extract1
+ br i1 %arg, label %exit, label %extract1
extract1:
call void @cold_use(ptr %local1)
- br i1 undef, label %extract2, label %extract3
+ br i1 %arg, label %extract2, label %extract3
extract2:
; Backedge.
diff --git a/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll b/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll
index 51ee47a7d2eda2..26faaa326141fc 100644
--- a/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll
+++ b/llvm/test/Transforms/HotColdSplit/lifetime-markers-on-inputs-3.ll
@@ -12,11 +12,11 @@ declare void @use(ptr, ptr)
declare void @use2(ptr, ptr) cold
; CHECK-LABEL: define {{.*}}@foo(
-define void @foo() {
+define void @foo(i1 %arg) {
entry:
%local1 = alloca ptr
%local2 = alloca ptr
- br i1 undef, label %normalPath, label %outlinedPath
+ br i1 %arg, label %normalPath, label %outlinedPath
normalPath:
call void @use(ptr %local1, ptr %local2)
diff --git a/llvm/test/Transforms/HotColdSplit/minsize.ll b/llvm/test/Transforms/HotColdSplit/minsize.ll
index 7ac666672d4b5f..e3d394cfd916f5 100644
--- a/llvm/test/Transforms/HotColdSplit/minsize.ll
+++ b/llvm/test/Transforms/HotColdSplit/minsize.ll
@@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: @fun
; CHECK: call void @fun.cold.1
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
diff --git a/llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll b/llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
index 6a88fc13f0f204..7f2433501a69e2 100644
--- a/llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
+++ b/llvm/test/Transforms/HotColdSplit/outline-cold-asm.ll
@@ -9,9 +9,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: define {{.*}}@fun.cold.1(
; CHECK: asm ""
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
diff --git a/llvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll b/llvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll
index 55013aa96551d0..f69ba111d0e96d 100644
--- a/llvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll
+++ b/llvm/test/Transforms/HotColdSplit/outline-disjoint-diamonds.ll
@@ -5,15 +5,15 @@
; CHECK-NEXT: unreachable
; CHECK: call {{.*}}@fun.cold.2(
; CHECK-NEXT: unreachable
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %A.then, label %A.else
+ br i1 %arg, label %A.then, label %A.else
A.else:
br label %A.then4
A.then4:
- br i1 undef, label %A.then5, label %A.end
+ br i1 %arg, label %A.then5, label %A.end
A.then5:
br label %A.cleanup
@@ -26,7 +26,7 @@ A.cleanup:
unreachable
A.then:
- br i1 undef, label %B.then, label %B.else
+ br i1 %arg, label %B.then, label %B.else
B.then:
ret void
@@ -35,7 +35,7 @@ B.else:
br label %B.then4
B.then4:
- br i1 undef, label %B.then5, label %B.end
+ br i1 %arg, label %B.then5, label %B.end
B.then5:
br label %B.cleanup
diff --git a/llvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll b/llvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
index 81e34bbfadb111..7c07cd35a527c2 100644
--- a/llvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
+++ b/llvm/test/Transforms/HotColdSplit/phi-with-distinct-outlined-values.ll
@@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK: %p.ce = phi i32 [ 1, %coldbb ], [ 3, %coldbb2 ]
; CHECK-NEXT: store i32 %p.ce, ptr %p.ce.out
-define void @foo(i32 %cond) {
+define void @foo(i32 %cond, i1 %arg) {
entry:
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %if.end, label %coldbb
@@ -19,7 +19,7 @@ entry:
coldbb:
call void @sink()
call void @sideeffect()
- br i1 undef, label %if.end, label %coldbb2
+ br i1 %arg, label %if.end, label %coldbb2
coldbb2:
br label %if.end
diff --git a/llvm/test/Transforms/HotColdSplit/section-splitting-custom.ll b/llvm/test/Transforms/HotColdSplit/section-splitting-custom.ll
index d7836d0994b866..c794d40b28ec3c 100644
--- a/llvm/test/Transforms/HotColdSplit/section-splitting-custom.ll
+++ b/llvm/test/Transforms/HotColdSplit/section-splitting-custom.ll
@@ -14,9 +14,9 @@
; CHECK: define {{.*}}@fun.cold.1{{.*}} [[cold_attr:#[0-9]+]] section "__cold_custom"
; CHECK: attributes [[cold_attr]] = { {{.*}}noreturn
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
@@ -25,7 +25,7 @@ if.else:
br label %if.then4
if.then4:
- br i1 undef, label %if.then5, label %if.end
+ br i1 %arg, label %if.then5, label %if.end
if.then5:
br label %cleanup
diff --git a/llvm/test/Transforms/HotColdSplit/section-splitting-default.ll b/llvm/test/Transforms/HotColdSplit/section-splitting-default.ll
index 2cdccce93d8d79..87c7b7034f0474 100644
--- a/llvm/test/Transforms/HotColdSplit/section-splitting-default.ll
+++ b/llvm/test/Transforms/HotColdSplit/section-splitting-default.ll
@@ -13,9 +13,9 @@
; CHECK: define {{.*}}@fun.cold.1{{.*}} [[cold_attr:#[0-9]+]] section "__llvm_cold"
; CHECK: attributes [[cold_attr]] = { {{.*}}noreturn
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
@@ -24,7 +24,7 @@ if.else:
br label %if.then4
if.then4:
- br i1 undef, label %if.then5, label %if.end
+ br i1 %arg, label %if.then5, label %if.end
if.then5:
br label %cleanup
diff --git a/llvm/test/Transforms/HotColdSplit/split-cold-2.ll b/llvm/test/Transforms/HotColdSplit/split-cold-2.ll
index 44dfd6b668a3d8..603447a89b1de0 100644
--- a/llvm/test/Transforms/HotColdSplit/split-cold-2.ll
+++ b/llvm/test/Transforms/HotColdSplit/split-cold-2.ll
@@ -11,9 +11,9 @@
; CHECK: define internal {{.*}}@fun.cold.1{{.*}} [[cold_attr:#[0-9]+]]
; CHECK: attributes [[cold_attr]] = { {{.*}}noreturn
-define void @fun() {
+define void @fun(i1 %arg) {
entry:
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
ret void
@@ -22,7 +22,7 @@ if.else:
br label %if.then4
if.then4:
- br i1 undef, label %if.then5, label %if.end
+ br i1 %arg, label %if.then5, label %if.end
if.then5:
br label %cleanup
diff --git a/llvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll b/llvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll
index d6fbb883e6f0a1..59efa3d54e249d 100644
--- a/llvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll
+++ b/llvm/test/Transforms/HotColdSplit/succ-block-with-self-edge.ll
@@ -5,9 +5,9 @@ target triple = "x86_64-apple-macosx10.14.0"
; CHECK-LABEL: define {{.*}}@exit_block_with_same_incoming_vals
; CHECK: call {{.*}}@exit_block_with_same_incoming_vals.cold.1(
-; CHECK-NOT: br i1 undef
+; CHECK-NOT: br i1 %arg
; CHECK: phi i32 [ 0, %entry ], [ %p.ce.reload, %codeRepl ]
-define void @exit_block_with_same_incoming_vals(i32 %cond) {
+define void @exit_block_with_same_incoming_vals(i32 %cond, i1 %arg) {
entry:
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %if.end, label %coldbb
@@ -15,11 +15,11 @@ entry:
coldbb:
call void @sink()
call void @sideeffect()
- br i1 undef, label %if.end, label %coldbb2
+ br i1 %arg, label %if.end, label %coldbb2
coldbb2:
%p2 = phi i32 [0, %coldbb], [1, %coldbb2]
- br i1 undef, label %if.end, label %coldbb2
+ br i1 %arg, label %if.end, label %coldbb2
if.end:
%p = phi i32 [0, %entry], [1, %coldbb], [1, %coldbb2]
@@ -28,9 +28,9 @@ if.end:
; CHECK-LABEL: define {{.*}}@exit_block_with_distinct_incoming_vals
; CHECK: call {{.*}}@exit_block_with_distinct_incoming_vals.cold.1(
-; CHECK-NOT: br i1 undef
+; CHECK-NOT: br i1 %arg
; CHECK: phi i32 [ 0, %entry ], [ %p.ce.reload, %codeRepl ]
-define void @exit_block_with_distinct_incoming_vals(i32 %cond) {
+define void @exit_block_with_distinct_incoming_vals(i32 %cond, i1 %arg) {
entry:
%tobool = icmp eq i32 %cond, 0
br i1 %tobool, label %if.end, label %coldbb
@@ -38,11 +38,11 @@ entry:
coldbb:
call void @sink()
call void @sideeffect()
- br i1 undef, label %if.end, label %coldbb2
+ br i1 %arg, label %if.end, label %coldbb2
coldbb2:
%p2 = phi i32 [0, %coldbb], [1, %coldbb2]
- br i1 undef, label %if.end, label %coldbb2
+ br i1 %arg, label %if.end, label %coldbb2
if.end:
%p = phi i32 [0, %entry], [1, %coldbb], [2, %coldbb2]
diff --git a/llvm/test/Transforms/HotColdSplit/swifterror.ll b/llvm/test/Transforms/HotColdSplit/swifterror.ll
index 7821af9d1112fd..6df728c816ce1e 100644
--- a/llvm/test/Transforms/HotColdSplit/swifterror.ll
+++ b/llvm/test/Transforms/HotColdSplit/swifterror.ll
@@ -9,8 +9,8 @@ declare void @sink() cold
; CHECK-LABEL: define {{.*}}@in_arg(
; CHECK: call void @in_arg.cold.1(ptr swifterror
-define void @in_arg(ptr swifterror %error_ptr_ref) {
- br i1 undef, label %cold, label %exit
+define void @in_arg(ptr swifterror %error_ptr_ref, i1 %arg) {
+ br i1 %arg, label %cold, label %exit
cold:
store ptr undef, ptr %error_ptr_ref
@@ -23,9 +23,9 @@ exit:
; CHECK-LABEL: define {{.*}}@in_alloca(
; CHECK: call void @in_alloca.cold.1(ptr swifterror
-define void @in_alloca() {
+define void @in_alloca(i1 %arg) {
%err = alloca swifterror ptr
- br i1 undef, label %cold, label %exit
+ br i1 %arg, label %cold, label %exit
cold:
store ptr undef, ptr %err
>From a83a4e8b46e8462fd1b9d8a453090861fefaf154 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Mon, 11 Nov 2024 22:57:45 -0700
Subject: [PATCH 2/6] Remove br i1 undef in IndVarSimplify directory
---
.../2003-12-10-RemoveInstrCrash.ll | 4 +-
.../IndVarSimplify/2003-12-15-Crash.ll | 6 +-
.../IndVarSimplify/2005-11-18-Crash.ll | 4 +-
.../IndVarSimplify/2006-12-10-BitCast.ll | 4 +-
.../IndVarSimplify/2009-05-24-useafterfree.ll | 6 +-
.../IndVarSimplify/2011-09-10-widen-nsw.ll | 6 +-
.../IndVarSimplify/2011-09-19-vectoriv.ll | 4 +-
.../IndVarSimplify/2011-10-27-lftrnull.ll | 27 +--
.../2014-06-21-congruent-constant.ll | 4 +-
...-15-trunc-bug-expensive-range-inference.ll | 6 +-
.../IndVarSimplify/AArch64/widen-loop-comp.ll | 6 +-
.../X86/2011-11-15-multiexit.ll | 6 +-
.../IndVarSimplify/X86/eliminate-trunc.ll | 10 +-
.../Transforms/IndVarSimplify/X86/iv-widen.ll | 12 +-
.../Transforms/IndVarSimplify/X86/pr24804.ll | 6 +-
.../Transforms/IndVarSimplify/X86/pr24956.ll | 4 +-
.../Transforms/IndVarSimplify/X86/pr25576.ll | 4 +-
.../X86/variable-stride-ivs-1.ll | 8 +-
.../IndVarSimplify/X86/verify-scev.ll | 166 +++++++++---------
.../Transforms/IndVarSimplify/avoid-i0.ll | 6 +-
.../Transforms/IndVarSimplify/const_phi.ll | 4 +-
llvm/test/Transforms/IndVarSimplify/crash.ll | 10 +-
.../IndVarSimplify/divide-pointer.ll | 16 +-
.../IndVarSimplify/eliminate-comparison.ll | 14 +-
.../IndVarSimplify/lcssa-preservation.ll | 8 +-
.../IndVarSimplify/loop_evaluate11.ll | 4 +-
.../IndVarSimplify/loop_evaluate7.ll | 14 +-
.../IndVarSimplify/loop_evaluate8.ll | 14 +-
.../IndVarSimplify/no-iv-rewrite.ll | 41 +++--
.../phi-uses-value-multiple-times.ll | 6 +-
.../test/Transforms/IndVarSimplify/pr25578.ll | 12 +-
.../test/Transforms/IndVarSimplify/pr26974.ll | 10 +-
.../test/Transforms/IndVarSimplify/pr40454.ll | 18 +-
.../Transforms/IndVarSimplify/sentinel.ll | 19 +-
.../IndVarSimplify/single-element-range.ll | 4 +-
35 files changed, 256 insertions(+), 237 deletions(-)
diff --git a/llvm/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll b/llvm/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
index 69ccb5ce795417..bebfd2d01120d8 100644
--- a/llvm/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2003-12-10-RemoveInstrCrash.ll
@@ -1,6 +1,6 @@
; RUN: opt < %s -passes=indvars -disable-output
-define void @test() {
+define void @test(i1 %arg) {
entry:
%inc.2 = add i32 1, 1 ; <i32> [#uses=1]
br i1 false, label %no_exit, label %loopexit
@@ -10,7 +10,7 @@ no_exit: ; preds = %no_exit, %entry
%k.0.pn = phi i32 [ %inc.4, %no_exit ], [ 1, %entry ] ; <i32> [#uses=1]
%inc.3 = add i32 %j.0.pn, 1 ; <i32> [#uses=1]
%inc.4 = add i32 %k.0.pn, 1 ; <i32> [#uses=1]
- br i1 undef, label %no_exit, label %loopexit
+ br i1 %arg, label %no_exit, label %loopexit
loopexit: ; preds = %no_exit, %entry
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll b/llvm/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
index b0e99bfc1a5c74..592f627529ddde 100644
--- a/llvm/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2003-12-15-Crash.ll
@@ -1,5 +1,5 @@
; RUN: opt < %s -passes=indvars -disable-output
-define void @_ZN17CoinFactorization7cleanupEv() {
+define void @_ZN17CoinFactorization7cleanupEv(i1 %arg) {
entry:
br i1 false, label %loopexit.14, label %cond_continue.3
@@ -8,7 +8,7 @@ cond_continue.3: ; preds = %entry
loopexit.14: ; preds = %entry
%tmp.738 = sub i32 0, 0 ; <i32> [#uses=1]
- br i1 undef, label %no_exit.15.preheader, label %loopexit.15
+ br i1 %arg, label %no_exit.15.preheader, label %loopexit.15
no_exit.15.preheader: ; preds = %loopexit.14
br label %no_exit.15
@@ -16,7 +16,7 @@ no_exit.15.preheader: ; preds = %loopexit.14
no_exit.15: ; preds = %no_exit.15, %no_exit.15.preheader
%highC.0 = phi i32 [ %tmp.738, %no_exit.15.preheader ], [ %dec.0, %no_exit.15 ] ; <i32> [#uses=1]
%dec.0 = add i32 %highC.0, -1 ; <i32> [#uses=1]
- br i1 undef, label %no_exit.15, label %loopexit.15
+ br i1 %arg, label %no_exit.15, label %loopexit.15
loopexit.15: ; preds = %no_exit.15, %loopexit.14
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll b/llvm/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
index 60782aba6a5505..b5f08b4170922d 100644
--- a/llvm/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2005-11-18-Crash.ll
@@ -2,14 +2,14 @@
@fixtab = external global [29 x [29 x [2 x i32]]] ; <ptr> [#uses=1]
-define void @init_optabs() {
+define void @init_optabs(i1 %arg) {
entry:
br label %no_exit.0
no_exit.0: ; preds = %no_exit.0, %entry
%p.0.0 = phi ptr [ @fixtab, %entry ], [ %inc.0, %no_exit.0 ] ; <ptr> [#uses=1]
%inc.0 = getelementptr i32, ptr %p.0.0, i32 1 ; <ptr> [#uses=1]
- br i1 undef, label %no_exit.0, label %no_exit.1
+ br i1 %arg, label %no_exit.0, label %no_exit.1
no_exit.1: ; preds = %no_exit.0
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll b/llvm/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
index eaebb41b3dbac7..87e13752891b09 100644
--- a/llvm/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2006-12-10-BitCast.ll
@@ -4,7 +4,7 @@ target triple = "i686-apple-darwin8"
%struct.vorbis_dsp_state = type { i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, ptr }
%struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, ptr }
-define void @_ve_envelope_search() {
+define void @_ve_envelope_search(i1 %arg) {
entry:
br i1 false, label %cond_true27, label %bb137
@@ -20,7 +20,7 @@ cond_next182.i: ; preds = %cond_next182.i, %cond_true52
%tmp194.i53 = bitcast i32 %decay.i.0 to float ; <float> [#uses=1]
%tmp195.i = fsub float %tmp194.i53, 8.000000e+00 ; <float> [#uses=1]
%tmp195.i.upgrd.1 = bitcast float %tmp195.i to i32 ; <i32> [#uses=1]
- br i1 undef, label %cond_next182.i, label %bb418.i.preheader
+ br i1 %arg, label %cond_next182.i, label %bb418.i.preheader
bb418.i.preheader: ; preds = %cond_next182.i
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll b/llvm/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
index a4257482668f9a..eabff00dc832d7 100644
--- a/llvm/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2009-05-24-useafterfree.ll
@@ -3,7 +3,7 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
-define void @0(ptr, ptr, i32, i32) nounwind {
+define void @0(ptr, ptr, i32, i32, i1 %arg) nounwind {
br i1 false, label %bb.nph1.preheader, label %.outer._crit_edge
bb.nph1.preheader: ; preds = %4
@@ -12,7 +12,7 @@ bb.nph1.preheader: ; preds = %4
br label %bb.nph1
bb.nph1: ; preds = %.outer, %bb.nph1.preheader
- br i1 undef, label %bb.nph3.preheader, label %.outer
+ br i1 %arg, label %bb.nph3.preheader, label %.outer
bb.nph3.preheader: ; preds = %bb.nph1
br label %bb.nph3
@@ -31,7 +31,7 @@ bb.nph3: ; preds = %bb.nph3, %bb.nph3.preheader
br label %.outer
.outer: ; preds = %.outer.loopexit, %bb.nph1
- br i1 undef, label %bb.nph1, label %.outer._crit_edge.loopexit
+ br i1 %arg, label %bb.nph1, label %.outer._crit_edge.loopexit
.outer._crit_edge.loopexit: ; preds = %.outer
br label %.outer._crit_edge
diff --git a/llvm/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll b/llvm/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll
index 6b67308d231882..66f73acc539d80 100644
--- a/llvm/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2011-09-10-widen-nsw.ll
@@ -7,9 +7,9 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
declare void @use(i64 %x)
-define void @test() nounwind {
+define void @test(i1 %arg) nounwind {
entry:
- br i1 undef, label %for.body11, label %for.end285
+ br i1 %arg, label %for.body11, label %for.end285
for.body11: ; preds = %entry
%shl = shl i32 1, 1
@@ -17,7 +17,7 @@ for.body11: ; preds = %entry
br label %for.body153
for.body153: ; preds = %for.body153, %for.body11
- br i1 undef, label %for.body170, label %for.body153
+ br i1 %arg, label %for.body170, label %for.body153
; CHECK: add nuw nsw i64 %indvars.iv, 1
; CHECK: sub nsw i64 %indvars.iv, 2
diff --git a/llvm/test/Transforms/IndVarSimplify/2011-09-19-vectoriv.ll b/llvm/test/Transforms/IndVarSimplify/2011-09-19-vectoriv.ll
index 2a85476194be31..9315e6690e56f8 100644
--- a/llvm/test/Transforms/IndVarSimplify/2011-09-19-vectoriv.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2011-09-19-vectoriv.ll
@@ -1,9 +1,9 @@
; RUN: opt < %s -passes=indvars -S | FileCheck %s
; PR10946: Vector IVs are not SCEVable.
; CHECK-NOT: phi
-define void @test() nounwind {
+define void @test(i1 %arg) nounwind {
allocas:
- br i1 undef, label %cif_done, label %for_loop398
+ br i1 %arg, label %cif_done, label %for_loop398
cif_done: ; preds = %allocas
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll b/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
index 5113451ca5d599..7394dbff78e546 100644
--- a/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
@@ -5,20 +5,20 @@
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32-S32"
target triple = "thumbv7-apple-darwin"
-define void @test() nounwind {
+define void @test(i1 %arg) nounwind {
; CHECK-LABEL: @test(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[WHILE_COND:%.*]]
; CHECK: while.cond.loopexit:
; CHECK-NEXT: br label [[WHILE_COND_BACKEDGE:%.*]]
; CHECK: while.cond:
-; CHECK-NEXT: br i1 true, label [[WHILE_END:%.*]], label [[WHILE_BODY:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[WHILE_END:%.*]], label [[WHILE_BODY:%.*]]
; CHECK: while.body:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN165:%.*]], label [[WHILE_COND_BACKEDGE]]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN165:%.*]], label [[WHILE_COND_BACKEDGE]]
; CHECK: while.cond.backedge:
; CHECK-NEXT: br label [[WHILE_COND]]
; CHECK: if.then165:
-; CHECK-NEXT: br i1 undef, label [[WHILE_COND_BACKEDGE]], label [[FOR_BODY_LR_PH_I81:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[WHILE_COND_BACKEDGE]], label [[FOR_BODY_LR_PH_I81:%.*]]
; CHECK: for.body.lr.ph.i81:
; CHECK-NEXT: br label [[FOR_BODY_I86:%.*]]
; CHECK: for.body.i86:
@@ -28,17 +28,20 @@ define void @test() nounwind {
; CHECK-NEXT: br label [[FOR_BODY21_I:%.*]]
; CHECK: for.body21.i:
; CHECK-NEXT: [[DESTYPIXELPTR_010_I:%.*]] = phi ptr [ null, [[FOR_BODY21_LR_PH_I]] ], [ [[INCDEC_PTR_I:%.*]], [[IF_END_I126:%.*]] ]
-; CHECK-NEXT: br i1 undef, label [[IF_END_I126]], label [[IF_ELSE_I124:%.*]]
+; CHECK-NEXT: [[X_09_I:%.*]] = phi i32 [ 0, [[FOR_BODY21_LR_PH_I]] ], [ [[INC_I125:%.*]], [[IF_END_I126]] ]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_END_I126]], label [[IF_ELSE_I124:%.*]]
; CHECK: if.else.i124:
; CHECK-NEXT: store i8 undef, ptr [[DESTYPIXELPTR_010_I]], align 1
; CHECK-NEXT: br label [[IF_END_I126]]
; CHECK: if.end.i126:
; CHECK-NEXT: [[INCDEC_PTR_I]] = getelementptr inbounds i8, ptr [[DESTYPIXELPTR_010_I]], i32 1
-; CHECK-NEXT: br i1 true, label [[FOR_BODY21_I]], label [[FOR_END_I129_LOOPEXIT:%.*]]
+; CHECK-NEXT: [[INC_I125]] = add nuw i32 [[X_09_I]], 1
+; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC_I125]], undef
+; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY21_I]], label [[FOR_END_I129_LOOPEXIT:%.*]]
; CHECK: for.end.i129.loopexit:
; CHECK-NEXT: br label [[FOR_END_I129]]
; CHECK: for.end.i129:
-; CHECK-NEXT: br i1 false, label [[FOR_BODY_I86]], label [[WHILE_COND_LOOPEXIT:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY_I86]], label [[WHILE_COND_LOOPEXIT:%.*]]
; CHECK: while.end:
; CHECK-NEXT: br label [[BAIL:%.*]]
; CHECK: bail:
@@ -50,13 +53,13 @@ entry:
br label %while.cond
while.cond:
- br i1 undef, label %while.end, label %while.body
+ br i1 %arg, label %while.end, label %while.body
while.body: ; preds = %while.cond
- br i1 undef, label %if.then165, label %while.cond
+ br i1 %arg, label %if.then165, label %while.cond
if.then165: ; preds = %while.body
- br i1 undef, label %while.cond, label %for.body.lr.ph.i81
+ br i1 %arg, label %while.cond, label %for.body.lr.ph.i81
for.body.lr.ph.i81: ; preds = %if.then165
br label %for.body.i86
@@ -71,7 +74,7 @@ for.body21.lr.ph.i: ; preds = %for.body.i86
for.body21.i:
%destYPixelPtr.010.i = phi ptr [ null, %for.body21.lr.ph.i ], [ %incdec.ptr.i, %if.end.i126 ]
%x.09.i = phi i32 [ 0, %for.body21.lr.ph.i ], [ %inc.i125, %if.end.i126 ]
- br i1 undef, label %if.end.i126, label %if.else.i124
+ br i1 %arg, label %if.end.i126, label %if.else.i124
if.else.i124: ; preds = %for.body21.i
store i8 undef, ptr %destYPixelPtr.010.i, align 1
@@ -84,7 +87,7 @@ if.end.i126: ; preds = %if.else.i124, %for.
br i1 %cmp19.i, label %for.body21.i, label %for.end.i129
for.end.i129: ; preds = %if.end.i126, %for.body.i86
- br i1 undef, label %for.body.i86, label %while.cond
+ br i1 %arg, label %for.body.i86, label %while.cond
while.end: ; preds = %while.cond
br label %bail
diff --git a/llvm/test/Transforms/IndVarSimplify/2014-06-21-congruent-constant.ll b/llvm/test/Transforms/IndVarSimplify/2014-06-21-congruent-constant.ll
index 3e660bd6f2d20f..b08725c58c8ef1 100644
--- a/llvm/test/Transforms/IndVarSimplify/2014-06-21-congruent-constant.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2014-06-21-congruent-constant.ll
@@ -8,9 +8,9 @@
@c = external global ptr, align 8
-define void @test1() {
+define void @test1(i1 %arg) {
entry:
- br i1 undef, label %for.end12, label %for.cond.preheader
+ br i1 %arg, label %for.end12, label %for.cond.preheader
for.cond.preheader: ; preds = %entry
%0 = load ptr, ptr @c, align 8
diff --git a/llvm/test/Transforms/IndVarSimplify/2020-12-15-trunc-bug-expensive-range-inference.ll b/llvm/test/Transforms/IndVarSimplify/2020-12-15-trunc-bug-expensive-range-inference.ll
index 29e5c8aedfff12..e9a9d3d405e162 100644
--- a/llvm/test/Transforms/IndVarSimplify/2020-12-15-trunc-bug-expensive-range-inference.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2020-12-15-trunc-bug-expensive-range-inference.ll
@@ -3,7 +3,7 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
-define void @test() {
+define void @test(i1 %arg) {
; CHECK-LABEL: test
bb:
@@ -31,7 +31,7 @@ bb8: ; preds = %bb5, %bb3
bb10: ; preds = %bb13
%tmp11 = phi i32 [ %tmp15, %bb13 ]
- br i1 undef, label %bb12, label %bb1
+ br i1 %arg, label %bb12, label %bb1
bb12: ; preds = %bb10
ret void
@@ -39,7 +39,7 @@ bb12: ; preds = %bb10
bb13: ; preds = %bb13, %bb8
%tmp14 = phi i32 [ %tmp, %bb8 ], [ %tmp15, %bb13 ]
%tmp15 = add i32 %tmp14, undef
- br i1 undef, label %bb10, label %bb13
+ br i1 %arg, label %bb10, label %bb13
bb16: ; preds = %bb16, %bb4
%tmp17 = phi i32 [ %tmp27, %bb16 ], [ %tmp2, %bb4 ]
diff --git a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
index 99541b398226ad..6ef0c2b73aab3f 100644
--- a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
+++ b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
@@ -15,7 +15,7 @@ target datalayout = "n8:16:32:64"
@ptr = common global ptr null, align 8
-define i32 @test1() {
+define i32 @test1(i1 %arg) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 -1, ptr @idx, align 4
@@ -97,7 +97,7 @@ define void @test2(ptr %a, ptr %b, i8 %limit) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[LIMIT:%.*]] to i32
-; CHECK-NEXT: br i1 undef, label [[FOR_COND1_PREHEADER_PREHEADER:%.*]], label [[FOR_COND1_PREHEADER_US_PREHEADER:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[FOR_COND1_PREHEADER_PREHEADER:%.*]], label [[FOR_COND1_PREHEADER_US_PREHEADER:%.*]]
; CHECK: for.cond1.preheader.us.preheader:
; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[CONV]], i32 1)
; CHECK-NEXT: br label [[FOR_COND1_PREHEADER_US:%.*]]
@@ -139,7 +139,7 @@ define void @test2(ptr %a, ptr %b, i8 %limit) {
;
entry:
%conv = zext i8 %limit to i32
- br i1 undef, label %for.cond1.preheader, label %for.cond1.preheader.us
+ br i1 %arg, label %for.cond1.preheader, label %for.cond1.preheader.us
for.cond1.preheader.us:
%storemerge5.us = phi i32 [ 0, %entry ], [ %inc14.us, %for.inc13.us ]
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/2011-11-15-multiexit.ll b/llvm/test/Transforms/IndVarSimplify/X86/2011-11-15-multiexit.ll
index cd5bbd712c3e3b..23700371b9877f 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/2011-11-15-multiexit.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/2011-11-15-multiexit.ll
@@ -11,12 +11,12 @@ target triple = "x86_64-apple-darwin"
; CHECK: if.end:
; CHECK: phi ptr [ %first.lcssa, %early.exit ]
-define i32 @test(ptr %first, ptr %last) uwtable ssp {
+define i32 @test(ptr %first, ptr %last, i1 %arg) uwtable ssp {
entry:
- br i1 undef, label %if.end, label %if.then
+ br i1 %arg, label %if.end, label %if.then
if.then: ; preds = %entry
- br i1 undef, label %if.end, label %do.body
+ br i1 %arg, label %if.end, label %do.body
do.body: ; preds = %if.else, %if.then
%firstIV = phi ptr [ %incdec.ptr2, %if.else ], [ %first, %if.then ]
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/eliminate-trunc.ll b/llvm/test/Transforms/IndVarSimplify/X86/eliminate-trunc.ll
index e16f429b757987..565ac5c8743d47 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/eliminate-trunc.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/eliminate-trunc.ll
@@ -491,13 +491,13 @@ exit:
ret void
}
-define void @test_11() {
+define void @test_11(i1 %arg) {
; CHECK-LABEL: @test_11(
; CHECK-NEXT: br label [[BB1:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: br i1 undef, label [[BB2:%.*]], label [[BB6:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[BB2:%.*]], label [[BB6:%.*]]
; CHECK: bb2:
-; CHECK-NEXT: br i1 undef, label [[BB3:%.*]], label [[BB4:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[BB3:%.*]], label [[BB4:%.*]]
; CHECK: bb3:
; CHECK-NEXT: br label [[BB4]]
; CHECK: bb4:
@@ -513,11 +513,11 @@ define void @test_11() {
bb1: ; preds = %bb6, %0
%e.5.0 = phi i32 [ 0, %0 ], [ %_tmp32, %bb6 ]
- br i1 undef, label %bb2, label %bb6
+ br i1 %arg, label %bb2, label %bb6
bb2: ; preds = %bb1
%_tmp15 = trunc i32 %e.5.0 to i16
- br i1 undef, label %bb3, label %bb4
+ br i1 %arg, label %bb3, label %bb4
bb3: ; preds = %bb2
br label %bb4
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/iv-widen.ll b/llvm/test/Transforms/IndVarSimplify/X86/iv-widen.ll
index 4e0c503794bfe4..cc0f2587266a2a 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/iv-widen.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/iv-widen.ll
@@ -13,10 +13,10 @@ declare void @use(i64 %x)
; Only one phi now.
; One trunc for the gep.
; One trunc for the dummy() call.
-define void @loop_0(ptr %a) {
+define void @loop_0(ptr %a, i1 %arg) {
; CHECK-LABEL: @loop_0(
; CHECK-NEXT: Prologue:
-; CHECK-NEXT: br i1 undef, label [[B18_PREHEADER:%.*]], label [[B6:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[B18_PREHEADER:%.*]], label [[B6:%.*]]
; CHECK: B18.preheader:
; CHECK-NEXT: br label [[B18:%.*]]
; CHECK: B18:
@@ -42,7 +42,7 @@ define void @loop_0(ptr %a) {
; CHECK-NEXT: unreachable
;
Prologue:
- br i1 undef, label %B18, label %B6
+ br i1 %arg, label %B18, label %B6
B18: ; preds = %B24, %Prologue
%.02 = phi i32 [ 0, %Prologue ], [ %tmp33, %B24 ]
@@ -67,10 +67,10 @@ exit24: ; preds = %B18
}
; Make sure that dead zext is removed and no widening happens.
-define void @loop_0_dead(ptr %a) {
+define void @loop_0_dead(ptr %a, i1 %arg) {
; CHECK-LABEL: @loop_0_dead(
; CHECK-NEXT: Prologue:
-; CHECK-NEXT: br i1 undef, label [[B18_PREHEADER:%.*]], label [[B6:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[B18_PREHEADER:%.*]], label [[B6:%.*]]
; CHECK: B18.preheader:
; CHECK-NEXT: br label [[B18:%.*]]
; CHECK: B18:
@@ -93,7 +93,7 @@ define void @loop_0_dead(ptr %a) {
; CHECK-NEXT: unreachable
;
Prologue:
- br i1 undef, label %B18, label %B6
+ br i1 %arg, label %B18, label %B6
B18: ; preds = %B24, %Prologue
%.02 = phi i32 [ 0, %Prologue ], [ %tmp33, %B24 ]
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/pr24804.ll b/llvm/test/Transforms/IndVarSimplify/X86/pr24804.ll
index 2310aa8e6cb3cf..24651d2cd2fc99 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/pr24804.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/pr24804.ll
@@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu"
; Checking for a crash
-define void @f(ptr %a) {
+define void @f(ptr %a, i1 %arg) {
; CHECK-LABEL: @f(
entry:
br label %for.cond
@@ -15,10 +15,10 @@ for.cond: ; preds = %for.inc, %for.cond,
%add = add nsw i32 %iv, 1
%idxprom = sext i32 %add to i64
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
- br i1 undef, label %for.cond, label %for.inc
+ br i1 %arg, label %for.cond, label %for.inc
for.inc: ; preds = %for.cond
- br i1 undef, label %for.cond, label %for.end
+ br i1 %arg, label %for.cond, label %for.end
for.end: ; preds = %for.inc
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/pr24956.ll b/llvm/test/Transforms/IndVarSimplify/X86/pr24956.ll
index b5ee029143dd02..f6c47c8b33231c 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/pr24956.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/pr24956.ll
@@ -5,7 +5,7 @@
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"
-define void @re_update_line(ptr %new) {
+define void @re_update_line(ptr %new, i1 %arg) {
; CHECK: @re_update_line(
entry:
%incdec.ptr6 = getelementptr inbounds i8, ptr %new, i64 1
@@ -26,7 +26,7 @@ for.cond.11: ; preds = %land.rhs.16
land.rhs.16: ; preds = %for.cond.11, %land.rhs.16.lr.ph
%p.053 = phi ptr [ %n.154, %land.rhs.16.lr.ph ], [ %incdec.ptr24, %for.cond.11 ]
- br i1 undef, label %for.cond.11, label %for.inc.26
+ br i1 %arg, label %for.cond.11, label %for.inc.26
for.inc.26: ; preds = %land.rhs.16, %for.cond.11, %for.cond.11.preheader
%incdec.ptr27 = getelementptr inbounds i8, ptr %n.154, i64 1
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/pr25576.ll b/llvm/test/Transforms/IndVarSimplify/X86/pr25576.ll
index 39034e0635189d..edc85dbbb10cd6 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/pr25576.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/pr25576.ll
@@ -3,14 +3,14 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define void @fn1() {
+define void @fn1(i1 %arg) {
; CHECK-LABEL: @fn1(
entry:
br label %for.cond.loopexit
for.cond.loopexit: ; preds = %for.inc7, %for.cond.loopexit, %entry
%c.1.lcssa = phi i32 [ %inc8, %for.inc7 ], [ 0, %for.cond.loopexit ], [ 0, %entry ]
- br i1 undef, label %for.cond.loopexit, label %for.cond4.preheader
+ br i1 %arg, label %for.cond.loopexit, label %for.cond4.preheader
for.cond4.preheader: ; preds = %for.inc7, %for.cond.loopexit
%c.17 = phi i32 [ %inc8, %for.inc7 ], [ 0, %for.cond.loopexit ]
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/variable-stride-ivs-1.ll b/llvm/test/Transforms/IndVarSimplify/X86/variable-stride-ivs-1.ll
index 300727b6a773e9..2536194f340680 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/variable-stride-ivs-1.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/variable-stride-ivs-1.ll
@@ -5,7 +5,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
target triple = "x86_64-undermydesk-freebsd8.0"
%struct.mbuf = type <{ ptr, ptr, i32, i8, i8, i8, i8 }>
-define i32 @crash(ptr %m) nounwind {
+define i32 @crash(ptr %m, i1 %arg) nounwind {
entry:
br label %for.cond
@@ -16,7 +16,7 @@ for.cond: ; preds = %if.end, %entry
br i1 %cmp, label %for.body, label %do.body
for.body: ; preds = %for.cond
- br i1 undef, label %if.end, label %do.body
+ br i1 %arg, label %if.end, label %do.body
if.end: ; preds = %for.body
%i.02 = trunc i32 %i.0 to i8 ; <i8> [#uses=1]
@@ -26,14 +26,14 @@ if.end: ; preds = %for.body
do.body: ; preds = %do.cond, %for.body, %for.cond
%chksum.2 = phi i8 [ undef, %do.cond ], [ %chksum.0, %for.body ], [ %chksum.0, %for.cond ] ; <i8> [#uses=1]
- br i1 undef, label %do.cond, label %bb.nph
+ br i1 %arg, label %do.cond, label %bb.nph
bb.nph: ; preds = %do.body
br label %while.body
while.body: ; preds = %while.body, %bb.nph
%chksum.13 = phi i8 [ undef, %while.body ], [ %chksum.2, %bb.nph ] ; <i8> [#uses=0]
- br i1 undef, label %do.cond, label %while.body
+ br i1 %arg, label %do.cond, label %while.body
do.cond: ; preds = %while.body, %do.body
br i1 false, label %do.end, label %do.body
diff --git a/llvm/test/Transforms/IndVarSimplify/X86/verify-scev.ll b/llvm/test/Transforms/IndVarSimplify/X86/verify-scev.ll
index f6758245a00e26..6271e778646319 100644
--- a/llvm/test/Transforms/IndVarSimplify/X86/verify-scev.ll
+++ b/llvm/test/Transforms/IndVarSimplify/X86/verify-scev.ll
@@ -2,48 +2,48 @@
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-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.8.0"
-define void @test1() nounwind uwtable ssp {
+define void @test1(i1 %arg) nounwind uwtable ssp {
entry:
- br i1 undef, label %for.end, label %for.body
+ br i1 %arg, label %for.end, label %for.body
for.body: ; preds = %for.body, %entry
br i1 false, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
- br i1 undef, label %for.end11, label %for.body3
+ br i1 %arg, label %for.end11, label %for.body3
for.body3: ; preds = %for.end
unreachable
for.end11: ; preds = %for.end
- br i1 undef, label %while.body, label %while.end
+ br i1 %arg, label %while.body, label %while.end
while.body: ; preds = %for.end11
unreachable
while.end: ; preds = %for.end11
- br i1 undef, label %if.end115, label %for.cond109
+ br i1 %arg, label %if.end115, label %for.cond109
for.cond109: ; preds = %while.end
unreachable
if.end115: ; preds = %while.end
- br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
+ br i1 %arg, label %while.body119.lr.ph.lr.ph, label %for.cond612
while.body119.lr.ph.lr.ph: ; preds = %if.end115
- br i1 undef, label %for.cond612, label %if.end123.us
+ br i1 %arg, label %for.cond612, label %if.end123.us
if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
br label %for.cond132.us
for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
- br i1 undef, label %if.then136.us, label %for.cond132.us
+ br i1 %arg, label %if.then136.us, label %for.cond132.us
if.then136.us: ; preds = %for.cond132.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.body211: ; preds = %while.body211, %if.then136.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.end220: ; preds = %while.body211, %if.then136.us
br label %for.cond246.outer
@@ -52,42 +52,42 @@ for.cond246.outer: ; preds = %for.inc558, %for.co
br label %for.cond246
for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
- br i1 undef, label %for.end562, label %if.end250
+ br i1 %arg, label %for.end562, label %if.end250
if.end250: ; preds = %for.cond246
- br i1 undef, label %if.end256, label %for.end562
+ br i1 %arg, label %if.end256, label %for.end562
if.end256: ; preds = %if.end250
%cmp272 = icmp eq i32 undef, undef
br i1 %cmp272, label %if.then274, label %for.cond404.preheader
for.cond404.preheader: ; preds = %if.end256
- br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
+ br i1 %arg, label %for.cond246.outer, label %for.body409.lr.ph
for.body409.lr.ph: ; preds = %for.cond404.preheader
br label %for.body409
if.then274: ; preds = %if.end256
- br i1 undef, label %for.cond246.outer, label %if.end309
+ br i1 %arg, label %for.cond246.outer, label %if.end309
if.end309: ; preds = %if.then274
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.body361: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.cond372.loopexit: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond394.preheader, label %for.cond246
+ br i1 %arg, label %for.cond394.preheader, label %for.cond246
for.cond394.preheader: ; preds = %for.cond372.loopexit
- br i1 undef, label %for.cond246.outer, label %for.body397
+ br i1 %arg, label %for.cond246.outer, label %for.body397
for.body397: ; preds = %for.cond394.preheader
unreachable
for.body409: ; preds = %for.inc558, %for.body409.lr.ph
%k.029 = phi i32 [ 1, %for.body409.lr.ph ], [ %inc559, %for.inc558 ]
- br i1 undef, label %if.then412, label %if.else433
+ br i1 %arg, label %if.then412, label %if.else433
if.then412: ; preds = %for.body409
br label %if.end440
@@ -96,13 +96,13 @@ if.else433: ; preds = %for.body409
br label %if.end440
if.end440: ; preds = %if.else433, %if.then412
- br i1 undef, label %for.inc558, label %if.end461
+ br i1 %arg, label %for.inc558, label %if.end461
if.end461: ; preds = %if.end440
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.body517: ; preds = %for.body517, %if.end461
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.cond528.loopexit: ; preds = %for.body517, %if.end461
br label %for.inc558
@@ -119,48 +119,48 @@ for.cond612: ; preds = %while.body119.lr.ph
unreachable
}
-define void @test2() nounwind uwtable ssp {
+define void @test2(i1 %arg) nounwind uwtable ssp {
entry:
- br i1 undef, label %for.end, label %for.body
+ br i1 %arg, label %for.end, label %for.body
for.body: ; preds = %for.body, %entry
- br i1 undef, label %for.end, label %for.body
+ br i1 %arg, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
- br i1 undef, label %for.end11, label %for.body3
+ br i1 %arg, label %for.end11, label %for.body3
for.body3: ; preds = %for.end
unreachable
for.end11: ; preds = %for.end
- br i1 undef, label %while.body, label %while.end
+ br i1 %arg, label %while.body, label %while.end
while.body: ; preds = %for.end11
unreachable
while.end: ; preds = %for.end11
- br i1 undef, label %if.end115, label %for.cond109
+ br i1 %arg, label %if.end115, label %for.cond109
for.cond109: ; preds = %while.end
unreachable
if.end115: ; preds = %while.end
- br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
+ br i1 %arg, label %while.body119.lr.ph.lr.ph, label %for.cond612
while.body119.lr.ph.lr.ph: ; preds = %if.end115
- br i1 undef, label %for.cond612, label %if.end123.us
+ br i1 %arg, label %for.cond612, label %if.end123.us
if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
br label %for.cond132.us
for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
- br i1 undef, label %if.then136.us, label %for.cond132.us
+ br i1 %arg, label %if.then136.us, label %for.cond132.us
if.then136.us: ; preds = %for.cond132.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.body211: ; preds = %while.body211, %if.then136.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.end220: ; preds = %while.body211, %if.then136.us
br label %for.cond246.outer
@@ -169,43 +169,43 @@ for.cond246.outer: ; preds = %for.inc558, %for.co
br label %for.cond246
for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
- br i1 undef, label %for.end562, label %if.end250
+ br i1 %arg, label %for.end562, label %if.end250
if.end250: ; preds = %for.cond246
- br i1 undef, label %if.end256, label %for.end562
+ br i1 %arg, label %if.end256, label %for.end562
if.end256: ; preds = %if.end250
%0 = load i32, ptr undef, align 4
- br i1 undef, label %if.then274, label %for.cond404.preheader
+ br i1 %arg, label %if.then274, label %for.cond404.preheader
for.cond404.preheader: ; preds = %if.end256
%add406 = add i32 0, %0
- br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
+ br i1 %arg, label %for.cond246.outer, label %for.body409.lr.ph
for.body409.lr.ph: ; preds = %for.cond404.preheader
br label %for.body409
if.then274: ; preds = %if.end256
- br i1 undef, label %for.cond246.outer, label %if.end309
+ br i1 %arg, label %for.cond246.outer, label %if.end309
if.end309: ; preds = %if.then274
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.body361: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.cond372.loopexit: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond394.preheader, label %for.cond246
+ br i1 %arg, label %for.cond394.preheader, label %for.cond246
for.cond394.preheader: ; preds = %for.cond372.loopexit
- br i1 undef, label %for.cond246.outer, label %for.body397
+ br i1 %arg, label %for.cond246.outer, label %for.body397
for.body397: ; preds = %for.cond394.preheader
unreachable
for.body409: ; preds = %for.inc558, %for.body409.lr.ph
%k.029 = phi i32 [ 1, %for.body409.lr.ph ], [ %inc559, %for.inc558 ]
- br i1 undef, label %if.then412, label %if.else433
+ br i1 %arg, label %if.then412, label %if.else433
if.then412: ; preds = %for.body409
br label %if.end440
@@ -214,13 +214,13 @@ if.else433: ; preds = %for.body409
br label %if.end440
if.end440: ; preds = %if.else433, %if.then412
- br i1 undef, label %for.inc558, label %if.end461
+ br i1 %arg, label %for.inc558, label %if.end461
if.end461: ; preds = %if.end440
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.body517: ; preds = %for.body517, %if.end461
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.cond528.loopexit: ; preds = %for.body517, %if.end461
br label %for.inc558
@@ -237,48 +237,48 @@ for.cond612: ; preds = %while.body119.lr.ph
unreachable
}
-define void @test3() nounwind uwtable ssp {
+define void @test3(i1 %arg) nounwind uwtable ssp {
entry:
- br i1 undef, label %for.end, label %for.body
+ br i1 %arg, label %for.end, label %for.body
for.body: ; preds = %for.body, %entry
- br i1 undef, label %for.end, label %for.body
+ br i1 %arg, label %for.end, label %for.body
for.end: ; preds = %for.body, %entry
- br i1 undef, label %for.end11, label %for.body3
+ br i1 %arg, label %for.end11, label %for.body3
for.body3: ; preds = %for.end
unreachable
for.end11: ; preds = %for.end
- br i1 undef, label %while.body, label %while.end
+ br i1 %arg, label %while.body, label %while.end
while.body: ; preds = %for.end11
unreachable
while.end: ; preds = %for.end11
- br i1 undef, label %if.end115, label %for.cond109
+ br i1 %arg, label %if.end115, label %for.cond109
for.cond109: ; preds = %while.end
unreachable
if.end115: ; preds = %while.end
- br i1 undef, label %while.body119.lr.ph.lr.ph, label %for.cond612
+ br i1 %arg, label %while.body119.lr.ph.lr.ph, label %for.cond612
while.body119.lr.ph.lr.ph: ; preds = %if.end115
- br i1 undef, label %for.cond612, label %if.end123.us
+ br i1 %arg, label %for.cond612, label %if.end123.us
if.end123.us: ; preds = %while.body119.lr.ph.lr.ph
br label %for.cond132.us
for.cond132.us: ; preds = %for.cond132.us, %if.end123.us
- br i1 undef, label %if.then136.us, label %for.cond132.us
+ br i1 %arg, label %if.then136.us, label %for.cond132.us
if.then136.us: ; preds = %for.cond132.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.body211: ; preds = %while.body211, %if.then136.us
- br i1 undef, label %while.end220, label %while.body211
+ br i1 %arg, label %while.end220, label %while.body211
while.end220: ; preds = %while.body211, %if.then136.us
br label %for.cond246.outer
@@ -287,40 +287,40 @@ for.cond246.outer: ; preds = %for.inc558, %for.co
br label %for.cond246
for.cond246: ; preds = %for.cond372.loopexit, %for.cond246.outer
- br i1 undef, label %for.end562, label %if.end250
+ br i1 %arg, label %for.end562, label %if.end250
if.end250: ; preds = %for.cond246
- br i1 undef, label %if.end256, label %for.end562
+ br i1 %arg, label %if.end256, label %for.end562
if.end256: ; preds = %if.end250
- br i1 undef, label %if.then274, label %for.cond404.preheader
+ br i1 %arg, label %if.then274, label %for.cond404.preheader
for.cond404.preheader: ; preds = %if.end256
- br i1 undef, label %for.cond246.outer, label %for.body409.lr.ph
+ br i1 %arg, label %for.cond246.outer, label %for.body409.lr.ph
for.body409.lr.ph: ; preds = %for.cond404.preheader
br label %for.body409
if.then274: ; preds = %if.end256
- br i1 undef, label %for.cond246.outer, label %if.end309
+ br i1 %arg, label %for.cond246.outer, label %if.end309
if.end309: ; preds = %if.then274
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.body361: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond372.loopexit, label %for.body361
+ br i1 %arg, label %for.cond372.loopexit, label %for.body361
for.cond372.loopexit: ; preds = %for.body361, %if.end309
- br i1 undef, label %for.cond394.preheader, label %for.cond246
+ br i1 %arg, label %for.cond394.preheader, label %for.cond246
for.cond394.preheader: ; preds = %for.cond372.loopexit
- br i1 undef, label %for.cond246.outer, label %for.body397
+ br i1 %arg, label %for.cond246.outer, label %for.body397
for.body397: ; preds = %for.cond394.preheader
unreachable
for.body409: ; preds = %for.inc558, %for.body409.lr.ph
- br i1 undef, label %if.then412, label %if.else433
+ br i1 %arg, label %if.then412, label %if.else433
if.then412: ; preds = %for.body409
br label %if.end440
@@ -329,19 +329,19 @@ if.else433: ; preds = %for.body409
br label %if.end440
if.end440: ; preds = %if.else433, %if.then412
- br i1 undef, label %for.inc558, label %if.end461
+ br i1 %arg, label %for.inc558, label %if.end461
if.end461: ; preds = %if.end440
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.body517: ; preds = %for.body517, %if.end461
- br i1 undef, label %for.cond528.loopexit, label %for.body517
+ br i1 %arg, label %for.cond528.loopexit, label %for.body517
for.cond528.loopexit: ; preds = %for.body517, %if.end461
br label %for.inc558
for.inc558: ; preds = %for.cond528.loopexit, %if.end440
- br i1 undef, label %for.cond246.outer, label %for.body409
+ br i1 %arg, label %for.cond246.outer, label %for.body409
for.end562: ; preds = %if.end250, %for.cond246
unreachable
@@ -350,33 +350,33 @@ for.cond612: ; preds = %while.body119.lr.ph
unreachable
}
-define void @test4() nounwind uwtable ssp {
+define void @test4(i1 %arg) nounwind uwtable ssp {
entry:
- br i1 undef, label %if.end8, label %if.else
+ br i1 %arg, label %if.end8, label %if.else
if.else: ; preds = %entry
br label %if.end8
if.end8: ; preds = %if.else, %entry
- br i1 undef, label %if.end26, label %if.else22
+ br i1 %arg, label %if.end26, label %if.else22
if.else22: ; preds = %if.end8
br label %if.end26
if.end26: ; preds = %if.else22, %if.end8
- br i1 undef, label %if.end35, label %if.else31
+ br i1 %arg, label %if.end35, label %if.else31
if.else31: ; preds = %if.end26
br label %if.end35
if.end35: ; preds = %if.else31, %if.end26
- br i1 undef, label %for.end226, label %for.body.lr.ph
+ br i1 %arg, label %for.end226, label %for.body.lr.ph
for.body.lr.ph: ; preds = %if.end35
br label %for.body48
for.body48: ; preds = %for.inc221, %for.body.lr.ph
- br i1 undef, label %for.inc221, label %for.body65.lr.ph
+ br i1 %arg, label %for.inc221, label %for.body65.lr.ph
for.body65.lr.ph: ; preds = %for.body48
%0 = load i32, ptr undef, align 4
@@ -385,25 +385,25 @@ for.body65.lr.ph: ; preds = %for.body48
for.body65.us: ; preds = %for.inc219.us, %for.body65.lr.ph
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc219.us ], [ 1, %for.body65.lr.ph ]
- br i1 undef, label %for.inc219.us, label %if.end72.us
+ br i1 %arg, label %for.inc219.us, label %if.end72.us
if.end72.us: ; preds = %for.body65.us
- br i1 undef, label %if.end93.us, label %if.then76.us
+ br i1 %arg, label %if.end93.us, label %if.then76.us
if.then76.us: ; preds = %if.end72.us
br label %if.end93.us
if.end93.us: ; preds = %if.then76.us, %if.end72.us
- br i1 undef, label %if.end110.us, label %for.inc219.us
+ br i1 %arg, label %if.end110.us, label %for.inc219.us
if.end110.us: ; preds = %if.end93.us
- br i1 undef, label %for.inc219.us, label %for.body142.us
+ br i1 %arg, label %for.inc219.us, label %for.body142.us
for.body142.us: ; preds = %for.cond139.loopexit.us, %if.end110.us
br label %for.cond152.us
for.cond152.us: ; preds = %for.cond152.us, %for.body142.us
- br i1 undef, label %for.cond139.loopexit.us, label %for.cond152.us
+ br i1 %arg, label %for.cond139.loopexit.us, label %for.cond152.us
for.inc219.us: ; preds = %for.cond139.loopexit.us, %if.end110.us, %if.end93.us, %for.body65.us
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
@@ -411,7 +411,7 @@ for.inc219.us: ; preds = %for.cond139.loopexi
br i1 %cmp64.us, label %for.inc221, label %for.body65.us
for.cond139.loopexit.us: ; preds = %for.cond152.us
- br i1 undef, label %for.inc219.us, label %for.body142.us
+ br i1 %arg, label %for.inc219.us, label %for.body142.us
for.inc221: ; preds = %for.inc219.us, %for.body48
br label %for.body48
diff --git a/llvm/test/Transforms/IndVarSimplify/avoid-i0.ll b/llvm/test/Transforms/IndVarSimplify/avoid-i0.ll
index 307736f82b9b05..a2666169a3422d 100644
--- a/llvm/test/Transforms/IndVarSimplify/avoid-i0.ll
+++ b/llvm/test/Transforms/IndVarSimplify/avoid-i0.ll
@@ -4,19 +4,19 @@
; Don't treat an and with 0 as a mask (trunc+zext).
-define i32 @int80(i8 signext %p_71) nounwind {
+define i32 @int80(i8 signext %p_71, i1 %arg) nounwind {
entry:
br label %bb
bb: ; preds = %bb6, %entry
%p_71_addr.0 = phi i8 [ %p_71, %entry ], [ %0, %bb6 ] ; <i8> [#uses=0]
- br i1 undef, label %bb4, label %bb1
+ br i1 %arg, label %bb4, label %bb1
bb1: ; preds = %bb
ret i32 0
bb4: ; preds = %bb4, %bb
- br i1 undef, label %bb6, label %bb4
+ br i1 %arg, label %bb6, label %bb4
bb6: ; preds = %bb4
%0 = and i8 0, 0 ; <i8> [#uses=1]
diff --git a/llvm/test/Transforms/IndVarSimplify/const_phi.ll b/llvm/test/Transforms/IndVarSimplify/const_phi.ll
index c13e743d9e105a..76152a2995de14 100644
--- a/llvm/test/Transforms/IndVarSimplify/const_phi.ll
+++ b/llvm/test/Transforms/IndVarSimplify/const_phi.ll
@@ -9,7 +9,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
; congruent IVs.
; CHECK-LABEL: crash
-define void @crash() {
+define void @crash(i1 %arg) {
entry:
br i1 false, label %not_taken, label %pre
@@ -26,7 +26,7 @@ loop:
; %phi0 and %phi1 are evaluated by SCEV to constant 0.
%phi0 = phi i32 [ 0, %loop ], [ %phi0.pre, %pre ]
%phi1 = phi i32 [ 0, %loop ], [ %phi1.pre, %pre ]
- br i1 undef, label %exit, label %loop
+ br i1 %arg, label %exit, label %loop
exit:
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/crash.ll b/llvm/test/Transforms/IndVarSimplify/crash.ll
index d3c417c5a15f57..88267e778b3552 100644
--- a/llvm/test/Transforms/IndVarSimplify/crash.ll
+++ b/llvm/test/Transforms/IndVarSimplify/crash.ll
@@ -20,14 +20,14 @@ define void @t2(ptr %P) nounwind {
}
; PR7562
-define void @fannkuch() nounwind {
+define void @fannkuch(i1 %arg) nounwind {
entry: ; preds = %entry
br label %bb12
bb12: ; preds = %bb29, %entry
%i.1 = phi i32 [ undef, %entry ], [ %i.0, %bb29 ] ; <i32> [#uses=2]
%r.1 = phi i32 [ undef, %entry ], [ %r.0, %bb29 ] ; <i32> [#uses=2]
- br i1 undef, label %bb13, label %bb24
+ br i1 %arg, label %bb13, label %bb24
bb13: ; preds = %bb12
br label %bb24
@@ -47,7 +47,7 @@ bb28: ; preds = %bb27, %bb26
br i1 %1, label %bb27, label %bb29
bb29: ; preds = %bb28
- br i1 undef, label %bb12, label %bb30
+ br i1 %arg, label %bb12, label %bb30
bb30: ; preds = %bb29
%2 = add nsw i32 %r.0, 1 ; <i32> [#uses=1]
@@ -114,7 +114,7 @@ bb9:
}
; PR12536
-define void @fn1() noreturn nounwind {
+define void @fn1(i1 %arg) noreturn nounwind {
entry:
br label %for.cond
@@ -124,7 +124,7 @@ for.cond: ; preds = %for.end, %entry
for.cond1: ; preds = %for.cond1, %for.cond
%c.0 = phi i32 [ %b.0, %for.cond1 ], [ 0, %for.cond ]
- br i1 undef, label %for.cond1, label %for.end
+ br i1 %arg, label %for.cond1, label %for.end
for.end: ; preds = %for.cond1
%cmp2 = icmp slt i32 %c.0, 1
diff --git a/llvm/test/Transforms/IndVarSimplify/divide-pointer.ll b/llvm/test/Transforms/IndVarSimplify/divide-pointer.ll
index 8d09e7c78eb350..791f516404fdc9 100644
--- a/llvm/test/Transforms/IndVarSimplify/divide-pointer.ll
+++ b/llvm/test/Transforms/IndVarSimplify/divide-pointer.ll
@@ -6,12 +6,12 @@ target triple = "i386-apple-darwin10.0"
%struct.xyz = type <{ i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, [8 x i8], i64, i64, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [76 x i32], i32, [2 x %struct.uvw] }>
%struct.uvw = type <{ i64, i64 }>
-define i32 @foo(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4) nounwind {
+define i32 @foo(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
entry:
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
- br i1 undef, label %while.body.i, label %bcopy_internal.exit
+ br i1 %arg, label %while.body.i, label %bcopy_internal.exit
bcopy_internal.exit: ; preds = %while.body.i
%conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
@@ -28,12 +28,12 @@ if.then199: ; preds = %if.then199, %for.body
br label %if.then199
}
-define i32 @same_thing_but_signed(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4) nounwind {
+define i32 @same_thing_but_signed(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
entry:
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
- br i1 undef, label %while.body.i, label %bcopy_internal.exit
+ br i1 %arg, label %while.body.i, label %bcopy_internal.exit
bcopy_internal.exit: ; preds = %while.body.i
%conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
@@ -50,12 +50,12 @@ if.then199: ; preds = %if.then199, %for.body
br label %if.then199
}
-define i32 @same_thing_but_multiplied(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4) nounwind {
+define i32 @same_thing_but_multiplied(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
entry:
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
- br i1 undef, label %while.body.i, label %bcopy_internal.exit
+ br i1 %arg, label %while.body.i, label %bcopy_internal.exit
bcopy_internal.exit: ; preds = %while.body.i
%conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
@@ -72,12 +72,12 @@ if.then199: ; preds = %if.then199, %for.body
br label %if.then199
}
-define i32 @same_thing_but_xored(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4) nounwind {
+define i32 @same_thing_but_xored(ptr %header, ptr %p2, ptr %p3, ptr nocapture %p4, i1 %arg) nounwind {
entry:
br label %while.body.i
while.body.i: ; preds = %while.body.i, %entry
- br i1 undef, label %while.body.i, label %bcopy_internal.exit
+ br i1 %arg, label %while.body.i, label %bcopy_internal.exit
bcopy_internal.exit: ; preds = %while.body.i
%conv135 = ptrtoint ptr %header to i32 ; <i32> [#uses=1]
diff --git a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
index f0690f89f85d25..08f9856ac603d6 100644
--- a/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
+++ b/llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
@@ -138,13 +138,19 @@ bb20.loopexit:
; Indvars should eliminate the icmp here.
-define void @func_10() nounwind {
+define void @func_10(i1 %arg) nounwind {
; CHECK-LABEL: @func_10(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
-; CHECK-NEXT: store i64 0, ptr null, align 8
-; CHECK-NEXT: br i1 false, label [[LOOP]], label [[RETURN:%.*]]
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ [[I_NEXT:%.*]], [[LOOP]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[I]], 0
+; CHECK-NEXT: [[T1:%.*]] = zext i1 [[T0]] to i32
+; CHECK-NEXT: [[T2:%.*]] = add i32 [[T1]], [[I]]
+; CHECK-NEXT: [[U3:%.*]] = zext i32 [[T2]] to i64
+; CHECK-NEXT: store i64 [[U3]], ptr null, align 8
+; CHECK-NEXT: [[I_NEXT]] = add i32 [[I]], 1
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[LOOP]], label [[RETURN:%.*]]
; CHECK: return:
; CHECK-NEXT: ret void
;
@@ -159,7 +165,7 @@ loop:
%u3 = zext i32 %t2 to i64
store i64 %u3, ptr null
%i.next = add i32 %i, 1
- br i1 undef, label %loop, label %return
+ br i1 %arg, label %loop, label %return
return:
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll b/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
index f00a111aa6a6dd..79c806209a888a 100644
--- a/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
+++ b/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
@@ -4,7 +4,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-n8:16:32:64"
-define void @PR18642(i32 %x) {
+define void @PR18642(i32 %x, i1 %arg) {
; CHECK-LABEL: @PR18642(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
@@ -15,14 +15,12 @@ define void @PR18642(i32 %x) {
; CHECK: inner.latch:
; CHECK-NEXT: br i1 true, label [[INNER_HEADER]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: outer.latch:
-; CHECK-NEXT: br i1 false, label [[OUTER_HEADER]], label [[EXIT_LOOPEXIT1:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[OUTER_HEADER]], label [[EXIT_LOOPEXIT1:%.*]]
; CHECK: exit.loopexit:
-; CHECK-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ -2147483648, [[INNER_LATCH]] ]
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: exit.loopexit1:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
-; CHECK-NEXT: [[EXIT_PHI:%.*]] = phi i32 [ [[INC_LCSSA]], [[EXIT_LOOPEXIT]] ], [ undef, [[EXIT_LOOPEXIT1]] ]
; CHECK-NEXT: ret void
;
entry:
@@ -43,7 +41,7 @@ inner.latch:
br i1 %cmp2, label %inner.header, label %exit
outer.latch:
- br i1 undef, label %outer.header, label %exit
+ br i1 %arg, label %outer.header, label %exit
exit:
%exit.phi = phi i32 [ %inc, %inner.latch ], [ undef, %outer.latch ]
diff --git a/llvm/test/Transforms/IndVarSimplify/loop_evaluate11.ll b/llvm/test/Transforms/IndVarSimplify/loop_evaluate11.ll
index 912c48ea72b06e..f5f76b1544dccb 100644
--- a/llvm/test/Transforms/IndVarSimplify/loop_evaluate11.ll
+++ b/llvm/test/Transforms/IndVarSimplify/loop_evaluate11.ll
@@ -2,14 +2,14 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
-define void @slap_sl_mem_create() nounwind {
+define void @slap_sl_mem_create(i1 %arg) nounwind {
entry:
br label %bb15
bb15: ; preds = %bb15, %entry
%order_end.0 = phi i32 [ 0, %entry ], [ %tmp, %bb15 ] ; <i32> [#uses=1]
%tmp = add i32 %order_end.0, 1 ; <i32> [#uses=2]
- br i1 undef, label %bb17, label %bb15
+ br i1 %arg, label %bb17, label %bb15
bb17: ; preds = %bb17, %bb15
%order_start.0 = phi i32 [ %tmp1, %bb17 ], [ 0, %bb15 ] ; <i32> [#uses=2]
diff --git a/llvm/test/Transforms/IndVarSimplify/loop_evaluate7.ll b/llvm/test/Transforms/IndVarSimplify/loop_evaluate7.ll
index 4385876cc767ae..425d37e16ff7cc 100644
--- a/llvm/test/Transforms/IndVarSimplify/loop_evaluate7.ll
+++ b/llvm/test/Transforms/IndVarSimplify/loop_evaluate7.ll
@@ -4,21 +4,21 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
-define ptr @string_expandtabs(i32 %n, ptr %m) nounwind {
+define ptr @string_expandtabs(i32 %n, ptr %m, i1 %arg) nounwind {
entry:
- br i1 undef, label %bb33, label %bb1
+ br i1 %arg, label %bb33, label %bb1
bb1: ; preds = %entry
- br i1 undef, label %overflow1, label %bb15
+ br i1 %arg, label %overflow1, label %bb15
bb15: ; preds = %bb1
- br i1 undef, label %bb33, label %bb17
+ br i1 %arg, label %bb33, label %bb17
bb17: ; preds = %bb15
br label %bb30
bb19: ; preds = %bb30
- br i1 undef, label %bb20, label %bb29
+ br i1 %arg, label %bb20, label %bb29
bb20: ; preds = %bb19
%0 = load i32, ptr undef, align 4 ; <i32> [#uses=1]
@@ -45,10 +45,10 @@ bb29: ; preds = %bb23, %bb19
br label %bb30
bb30: ; preds = %bb29, %bb17
- br i1 undef, label %bb19, label %bb33
+ br i1 %arg, label %bb19, label %bb33
overflow2: ; preds = %bb21
- br i1 undef, label %bb32, label %overflow1
+ br i1 %arg, label %bb32, label %overflow1
bb32: ; preds = %overflow2
br label %overflow1
diff --git a/llvm/test/Transforms/IndVarSimplify/loop_evaluate8.ll b/llvm/test/Transforms/IndVarSimplify/loop_evaluate8.ll
index e0a98e02b9a729..e547811e064a05 100644
--- a/llvm/test/Transforms/IndVarSimplify/loop_evaluate8.ll
+++ b/llvm/test/Transforms/IndVarSimplify/loop_evaluate8.ll
@@ -6,23 +6,23 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
-define ptr @string_expandtabs() nounwind {
+define ptr @string_expandtabs(i1 %arg) nounwind {
; CHECK-LABEL: @string_expandtabs(
; CHECK-NOT: select
entry:
- br i1 undef, label %bb33, label %bb1
+ br i1 %arg, label %bb33, label %bb1
bb1: ; preds = %entry
- br i1 undef, label %overflow1, label %bb15
+ br i1 %arg, label %overflow1, label %bb15
bb15: ; preds = %bb1
- br i1 undef, label %bb33, label %bb17
+ br i1 %arg, label %bb33, label %bb17
bb17: ; preds = %bb15
br label %bb30
bb19: ; preds = %bb30
- br i1 undef, label %bb20, label %bb29
+ br i1 %arg, label %bb20, label %bb29
bb20: ; preds = %bb19
%0 = load i32, ptr undef, align 4 ; <i32> [#uses=1]
@@ -49,10 +49,10 @@ bb29: ; preds = %bb23, %bb19
br label %bb30
bb30: ; preds = %bb29, %bb17
- br i1 undef, label %bb19, label %bb33
+ br i1 %arg, label %bb19, label %bb33
overflow2: ; preds = %bb21
- br i1 undef, label %bb32, label %overflow1
+ br i1 %arg, label %bb32, label %overflow1
bb32: ; preds = %overflow2
br label %overflow1
diff --git a/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
index 5339468fe8036b..5bd28470ef76be 100644
--- a/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
+++ b/llvm/test/Transforms/IndVarSimplify/no-iv-rewrite.ll
@@ -255,13 +255,13 @@ exit:
; Test an edge case of removing an identity phi that directly feeds
; back to the loop iv.
-define void @identityphi(i32 %limit) nounwind {
+define void @identityphi(i32 %limit, i1 %arg) nounwind {
; CHECK-LABEL: @identityphi(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[CONTROL:%.*]] ]
-; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[CONTROL]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[IF_THEN:%.*]], label [[CONTROL]]
; CHECK: if.then:
; CHECK-NEXT: br label [[CONTROL]]
; CHECK: control:
@@ -276,7 +276,7 @@ entry:
loop:
%iv = phi i32 [ 0, %entry], [ %iv.next, %control ]
- br i1 undef, label %if.then, label %control
+ br i1 %arg, label %if.then, label %control
if.then:
br label %control
@@ -429,13 +429,13 @@ return:
; lowers the type without changing the expression.
%structIF = type { i32, float }
-define void @congruentgepiv(ptr %base) nounwind uwtable ssp {
+define void @congruentgepiv(ptr %base, i1 %arg) nounwind uwtable ssp {
; CHECK-LABEL: @congruentgepiv(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: store i32 4, ptr [[BASE:%.*]], align 4
-; CHECK-NEXT: br i1 false, label [[LATCH:%.*]], label [[EXIT:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[LATCH:%.*]], label [[EXIT:%.*]]
; CHECK: latch:
; CHECK-NEXT: br label [[LOOP]]
; CHECK: exit:
@@ -448,7 +448,7 @@ loop:
%ptr.iv = phi ptr [ %ptr.inc, %latch ], [ %base, %entry ]
%next = phi ptr [ %next, %latch ], [ %base, %entry ]
store i32 4, ptr %next
- br i1 undef, label %latch, label %exit
+ br i1 %arg, label %latch, label %exit
latch: ; preds = %for.inc50.i
%ptr.inc = getelementptr inbounds %structIF, ptr %ptr.iv, i64 1
@@ -462,47 +462,50 @@ declare void @use32(i32 %x)
declare void @use64(i64 %x)
; Test a widened IV that is used by a phi on different paths within the loop.
-define void @phiUsesTrunc() nounwind {
+define void @phiUsesTrunc(i1 %arg) nounwind {
; CHECK-LABEL: @phiUsesTrunc(
; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 undef, label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_END:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_END:%.*]]
; CHECK: for.body.preheader:
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
; CHECK: for.body:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
+; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 1, [[FOR_BODY_PREHEADER]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_INC:%.*]] ]
+; CHECK-NEXT: [[TMP0:%.*]] = trunc nuw nsw i64 [[INDVARS_IV]] to i32
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN:%.*]], label [[IF_ELSE:%.*]]
; CHECK: if.then:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN33:%.*]], label [[FOR_INC:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN33:%.*]], label [[FOR_INC]]
; CHECK: if.then33:
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: if.else:
-; CHECK-NEXT: br i1 undef, label [[IF_THEN97:%.*]], label [[FOR_INC]]
+; CHECK-NEXT: br i1 [[ARG]], label [[IF_THEN97:%.*]], label [[FOR_INC]]
; CHECK: if.then97:
-; CHECK-NEXT: call void @use64(i64 1)
+; CHECK-NEXT: call void @use64(i64 [[INDVARS_IV]])
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: for.inc:
-; CHECK-NEXT: [[KMIN_1:%.*]] = phi i32 [ 1, [[IF_THEN33]] ], [ 0, [[IF_THEN]] ], [ 1, [[IF_THEN97]] ], [ 0, [[IF_ELSE]] ]
+; CHECK-NEXT: [[KMIN_1:%.*]] = phi i32 [ [[TMP0]], [[IF_THEN33]] ], [ 0, [[IF_THEN]] ], [ [[TMP0]], [[IF_THEN97]] ], [ 0, [[IF_ELSE]] ]
; CHECK-NEXT: call void @use32(i32 [[KMIN_1]])
-; CHECK-NEXT: br i1 false, label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]]
+; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]]
; CHECK: for.end.loopexit:
; CHECK-NEXT: br label [[FOR_END]]
; CHECK: for.end:
; CHECK-NEXT: ret void
;
entry:
- br i1 undef, label %for.body, label %for.end
+ br i1 %arg, label %for.body, label %for.end
for.body:
%iv = phi i32 [ %inc, %for.inc ], [ 1, %entry ]
- br i1 undef, label %if.then, label %if.else
+ br i1 %arg, label %if.then, label %if.else
if.then:
- br i1 undef, label %if.then33, label %for.inc
+ br i1 %arg, label %if.then33, label %for.inc
if.then33:
br label %for.inc
if.else:
- br i1 undef, label %if.then97, label %for.inc
+ br i1 %arg, label %if.then97, label %for.inc
if.then97:
%idxprom100 = sext i32 %iv to i64
@@ -513,7 +516,7 @@ for.inc:
%kmin.1 = phi i32 [ %iv, %if.then33 ], [ 0, %if.then ], [ %iv, %if.then97 ], [ 0, %if.else ]
call void @use32(i32 %kmin.1)
%inc = add nsw i32 %iv, 1
- br i1 undef, label %for.body, label %for.end
+ br i1 %arg, label %for.body, label %for.end
for.end:
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll b/llvm/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
index 8ee01bfba16489..d27556a9cdfab3 100644
--- a/llvm/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
+++ b/llvm/test/Transforms/IndVarSimplify/phi-uses-value-multiple-times.ll
@@ -8,7 +8,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
@ue = external global i64
-define i32 @foo() nounwind {
+define i32 @foo(i1 %arg) nounwind {
entry:
br label %bb38.i
@@ -16,7 +16,7 @@ bb14.i27:
%t0 = load i64, ptr @ue, align 8
%t1 = sub i64 %t0, %i.0.i35
%t2 = add i64 %t1, 1
- br i1 undef, label %bb15.i28, label %bb19.i31
+ br i1 %arg, label %bb15.i28, label %bb19.i31
bb15.i28:
br label %bb19.i31
@@ -26,7 +26,7 @@ bb19.i31:
br label %bb35.i
bb35.i:
- br i1 undef, label %bb37.i, label %bb14.i27
+ br i1 %arg, label %bb37.i, label %bb14.i27
bb37.i:
%t3 = add i64 %i.0.i35, 1
diff --git a/llvm/test/Transforms/IndVarSimplify/pr25578.ll b/llvm/test/Transforms/IndVarSimplify/pr25578.ll
index 380e8171798b01..cf8a1cc5cb23ba 100644
--- a/llvm/test/Transforms/IndVarSimplify/pr25578.ll
+++ b/llvm/test/Transforms/IndVarSimplify/pr25578.ll
@@ -4,7 +4,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
declare void @use(i64 %x)
; CHECK-LABEL: @foo
-define void @foo() {
+define void @foo(i1 %arg) {
entry:
br label %L1_header
@@ -21,16 +21,16 @@ L2_header:
br label %L3_header
L3_header:
- br i1 undef, label %L3_latch, label %L2_exiting_1
+ br i1 %arg, label %L3_latch, label %L2_exiting_1
L3_latch:
- br i1 undef, label %L3_header, label %L2_exiting_2
+ br i1 %arg, label %L3_header, label %L2_exiting_2
L2_exiting_1:
- br i1 undef, label %L2_latch, label %L1_latch
+ br i1 %arg, label %L2_latch, label %L1_latch
L2_exiting_2:
- br i1 undef, label %L2_latch, label %L1_latch
+ br i1 %arg, label %L2_latch, label %L1_latch
L2_latch:
%i_next = add nsw i32 %i, 1
@@ -41,7 +41,7 @@ L1_latch:
; CHECK: %i_lcssa = phi i32 [ %[[TRUNC]], %L2_exiting_1 ], [ %[[TRUNC]], %L2_exiting_2 ]
%i_lcssa = phi i32 [ %i, %L2_exiting_1 ], [ %i, %L2_exiting_2 ]
- br i1 undef, label %exit, label %L1_header
+ br i1 %arg, label %exit, label %L1_header
exit:
ret void
diff --git a/llvm/test/Transforms/IndVarSimplify/pr26974.ll b/llvm/test/Transforms/IndVarSimplify/pr26974.ll
index 1daaf34eaaeba4..3e4aea86208aaf 100644
--- a/llvm/test/Transforms/IndVarSimplify/pr26974.ll
+++ b/llvm/test/Transforms/IndVarSimplify/pr26974.ll
@@ -8,13 +8,13 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@c = external global i32, align 4
; CHECK-LABEL: @fn1
-define void @fn1() {
+define void @fn1(i1 %arg) {
entry:
br label %for.body
for.cond1.preheader: ; preds = %for.body
%0 = load i32, ptr @c, align 4
- br i1 undef, label %for.cond1.us.preheader, label %for.cond1
+ br i1 %arg, label %for.cond1.us.preheader, label %for.cond1
for.cond1.us.preheader: ; preds = %for.cond1.preheader
br label %for.cond1.us
@@ -23,13 +23,13 @@ for.cond1.us: ; preds = %for.cond1.us, %for.
br label %for.cond1.us
for.body: ; preds = %for.body, %entry
- br i1 undef, label %for.body, label %for.cond1.preheader
+ br i1 %arg, label %for.body, label %for.cond1.preheader
for.cond1: ; preds = %for.cond1.preheader
br i1 true, label %for.body9.lr.ph, label %for.cond13.preheader
for.body9.lr.ph: ; preds = %for.cond1
- br i1 undef, label %for.body9.us.preheader, label %for.body9
+ br i1 %arg, label %for.body9.us.preheader, label %for.body9
for.body9.us.preheader: ; preds = %for.body9.lr.ph
br label %for.body9.us
@@ -47,7 +47,7 @@ for.body9: ; preds = %for.body9.lr.ph
for.cond13: ; preds = %for.cond13, %for.cond13.preheader
%d.1 = phi i32 [ %t.1, %for.cond13 ], [ %0, %for.cond13.preheader ]
%t.1 = phi i32 [ %b.0.lcssa, %for.cond13 ], [ %0, %for.cond13.preheader ]
- br i1 undef, label %for.cond18.preheader, label %for.cond13
+ br i1 %arg, label %for.cond18.preheader, label %for.cond13
for.cond18.preheader: ; preds = %for.cond13
br label %for.cond18
diff --git a/llvm/test/Transforms/IndVarSimplify/pr40454.ll b/llvm/test/Transforms/IndVarSimplify/pr40454.ll
index d77ec74b330c10..d88525649a7b53 100644
--- a/llvm/test/Transforms/IndVarSimplify/pr40454.ll
+++ b/llvm/test/Transforms/IndVarSimplify/pr40454.ll
@@ -3,24 +3,28 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
-define void @test() {
+define void @test(i1 %arg) {
; CHECK-LABEL: @test(
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB2:%.*]]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB2]]
; CHECK: bb2:
-; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ -9, [[BB:%.*]] ], [ -10, [[BB1:%.*]] ]
+; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ -9, [[BB:%.*]] ], [ [[TMP6:%.*]], [[BB1:%.*]] ]
; CHECK-NEXT: br label [[BB3:%.*]]
; CHECK: bb3:
-; CHECK-NEXT: br i1 false, label [[BB5:%.*]], label [[BB12:%.*]]
+; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ -9, [[BB2]] ], [ [[TMP6]], [[BB10:%.*]] ]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[BB5:%.*]], label [[BB12:%.*]]
; CHECK: bb5:
-; CHECK-NEXT: br i1 undef, label [[BB8:%.*]], label [[BB9:%.*]]
+; CHECK-NEXT: [[TMP6]] = add i32 [[TMP4]], -1
+; CHECK-NEXT: [[TMP7:%.*]] = zext i32 [[TMP6]] to i64
+; CHECK-NEXT: br i1 [[ARG]], label [[BB8:%.*]], label [[BB9:%.*]]
; CHECK: bb8:
-; CHECK-NEXT: br label [[BB10:%.*]]
+; CHECK-NEXT: br label [[BB10]]
; CHECK: bb9:
; CHECK-NEXT: br label [[BB10]]
; CHECK: bb10:
+; CHECK-NEXT: [[TMP11:%.*]] = and i64 undef, [[TMP7]]
; CHECK-NEXT: br label [[BB3]]
; CHECK: bb12:
; CHECK-NEXT: ret void
@@ -38,12 +42,12 @@ bb2: ; preds = %bb1, %bb
bb3: ; preds = %bb10, %bb2
%tmp4 = phi i32 [ -9, %bb2 ], [ %tmp6, %bb10 ]
- br i1 undef, label %bb5, label %bb12
+ br i1 %arg, label %bb5, label %bb12
bb5: ; preds = %bb3
%tmp6 = add i32 %tmp4, -1
%tmp7 = zext i32 %tmp6 to i64
- br i1 undef, label %bb8, label %bb9
+ br i1 %arg, label %bb8, label %bb9
bb8: ; preds = %bb5
br label %bb10
diff --git a/llvm/test/Transforms/IndVarSimplify/sentinel.ll b/llvm/test/Transforms/IndVarSimplify/sentinel.ll
index f9ee4a61f48621..d1140affb5a4b8 100644
--- a/llvm/test/Transforms/IndVarSimplify/sentinel.ll
+++ b/llvm/test/Transforms/IndVarSimplify/sentinel.ll
@@ -4,25 +4,30 @@
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"
-define void @test() personality ptr @snork {
+define void @test(i1 %arg) personality ptr @snork {
; CHECK-LABEL: @test(
; CHECK-NEXT: bb:
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb1:
-; CHECK-NEXT: br i1 true, label [[BB2:%.*]], label [[BB4]]
+; CHECK-NEXT: [[INDVARS_IV_NEXT:%.*]] = add i32 [[INDVARS_IV:%.*]], 1
+; CHECK-NEXT: [[TMP0:%.*]] = sub i32 [[TMP1:%.*]], [[SMAX:%.*]]
+; CHECK-NEXT: br i1 [[ARG:%.*]], label [[BB2:%.*]], label [[BB4]]
; CHECK: bb2:
-; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ undef, [[BB1:%.*]] ]
+; CHECK-NEXT: [[TMP3:%.*]] = phi i32 [ [[TMP0]], [[BB1:%.*]] ]
; CHECK-NEXT: ret void
; CHECK: bb4:
-; CHECK-NEXT: [[TMP6:%.*]] = invoke i32 @quux() [ "deopt"(i32 0, i32 0, i32 0, i32 180, i32 0, i32 25, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 3, i32 undef, i32 3, i32 undef, i32 7, ptr null, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 4, double undef, i32 7, ptr null, i32 4, i64 undef, i32 7, ptr null, i32 0, ptr addrspace(1) undef, i32 3, i32 undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 7, ptr null) ]
-; CHECK-NEXT: to label [[BB7:%.*]] unwind label [[BB15:%.*]]
+; CHECK-NEXT: [[INDVARS_IV]] = phi i32 [ [[INDVARS_IV_NEXT]], [[BB1]] ], [ undef, [[BB:%.*]] ]
+; CHECK-NEXT: [[SMAX]] = call i32 @llvm.smax.i32(i32 [[INDVARS_IV]], i32 36)
+; CHECK-NEXT: [[TMP6:%.*]] = invoke i32 @quux() [ "deopt"(i32 0, i32 0, i32 0, i32 180, i32 0, i32 25, i32 0, i32 7, ptr null, i32 7, ptr null, i32 7, ptr null, i32 3, i32 [[INDVARS_IV]], i32 3, i32 undef, i32 7, ptr null, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 3, i32 undef, i32 4, double undef, i32 7, ptr null, i32 4, i64 undef, i32 7, ptr null, i32 0, ptr addrspace(1) undef, i32 3, i32 undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 0, ptr addrspace(1) undef, i32 7, ptr null) ]
+; CHECK-NEXT: to label [[BB7:%.*]] unwind label [[BB15:%.*]]
; CHECK: bb7:
+; CHECK-NEXT: [[TMP1]] = add i32 [[TMP6]], [[INDVARS_IV]]
; CHECK-NEXT: br label [[BB9:%.*]]
; CHECK: bb9:
; CHECK-NEXT: br i1 true, label [[BB1]], label [[BB9]]
; CHECK: bb15:
; CHECK-NEXT: [[TMP16:%.*]] = landingpad { ptr, i32 }
-; CHECK-NEXT: cleanup
+; CHECK-NEXT: cleanup
; CHECK-NEXT: ret void
;
@@ -31,7 +36,7 @@ bb:
bb1: ; preds = %bb9
%tmp = phi i32 [ %tmp12, %bb9 ]
- br i1 undef, label %bb2, label %bb4
+ br i1 %arg, label %bb2, label %bb4
bb2: ; preds = %bb1
%tmp3 = phi i32 [ %tmp, %bb1 ]
diff --git a/llvm/test/Transforms/IndVarSimplify/single-element-range.ll b/llvm/test/Transforms/IndVarSimplify/single-element-range.ll
index ef889fdc51c1db..db9bec1b2d9b2d 100644
--- a/llvm/test/Transforms/IndVarSimplify/single-element-range.ll
+++ b/llvm/test/Transforms/IndVarSimplify/single-element-range.ll
@@ -3,9 +3,9 @@
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:64"
target triple = "armv6-apple-darwin10"
-define void @sqlite3_free_table(ptr %azResult) nounwind {
+define void @sqlite3_free_table(ptr %azResult, i1 %arg) nounwind {
entry:
- br i1 undef, label %return, label %bb
+ br i1 %arg, label %return, label %bb
bb: ; preds = %entry
%0 = load ptr, ptr undef, align 4 ; <ptr> [#uses=2]
>From 4559b4e23e8155681e13ff678aa89a9beba13533 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Wed, 13 Nov 2024 21:17:39 -0700
Subject: [PATCH 3/6] Remove br i1 undef in Inline directory
---
.../Inline/infinite-loop-two-predecessors.ll | 6 +++---
.../Transforms/Inline/inline-indirect-chain.ll | 16 ++++++++--------
.../Inline/inline-invoke-with-asm-call.ll | 4 ++--
llvm/test/Transforms/Inline/inline_cleanup.ll | 18 +++++++++---------
llvm/test/Transforms/Inline/pr33637.ll | 4 ++--
llvm/test/Transforms/Inline/pr53206.ll | 6 +++---
6 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/llvm/test/Transforms/Inline/infinite-loop-two-predecessors.ll b/llvm/test/Transforms/Inline/infinite-loop-two-predecessors.ll
index e41d37d87ee315..50e33824876e42 100644
--- a/llvm/test/Transforms/Inline/infinite-loop-two-predecessors.ll
+++ b/llvm/test/Transforms/Inline/infinite-loop-two-predecessors.ll
@@ -1,6 +1,6 @@
; RUN: opt -S -o - %s -passes=inline | FileCheck %s
-define void @f1() {
+define void @f1(i1 %arg) {
bb.0:
br i1 false, label %bb.2, label %bb.1
@@ -12,7 +12,7 @@ bb.2: ; preds = %bb.0, %bb.1
br i1 %tmp0, label %bb.4, label %bb.3
bb.3: ; preds = %bb.3, %bb.3
- br i1 undef, label %bb.3, label %bb.3
+ br i1 %arg, label %bb.3, label %bb.3
bb.4: ; preds = %bb.2
ret void
@@ -20,7 +20,7 @@ bb.4: ; preds = %bb.2
define void @f2() {
bb.0:
- call void @f1()
+ call void @f1(i1 1)
ret void
}
diff --git a/llvm/test/Transforms/Inline/inline-indirect-chain.ll b/llvm/test/Transforms/Inline/inline-indirect-chain.ll
index 4083ad6d30caeb..0e1b975cd16007 100644
--- a/llvm/test/Transforms/Inline/inline-indirect-chain.ll
+++ b/llvm/test/Transforms/Inline/inline-indirect-chain.ll
@@ -1,23 +1,23 @@
; RUN: opt -passes=inline,early-cse -earlycse-debug-hash < %s
; This test used to crash (PR35469).
-define void @func1() {
- tail call void @func2()
+define void @func1(i1 %arg) {
+ tail call void @func2(i1 %arg)
ret void
}
-define void @func2() {
- tail call void @func3()
+define void @func2(i1 %arg) {
+ tail call void @func3(i1 %arg)
ret void
}
-define void @func3() {
- tail call void @func4()
+define void @func3(i1 %arg) {
+ tail call void @func4(i1 %arg)
ret void
}
-define void @func4() {
- br i1 undef, label %left, label %right
+define void @func4(i1 %arg) {
+ br i1 %arg, label %left, label %right
left:
tail call void @func5()
diff --git a/llvm/test/Transforms/Inline/inline-invoke-with-asm-call.ll b/llvm/test/Transforms/Inline/inline-invoke-with-asm-call.ll
index c2bfa79fa2ec63..97f0ed11d3b32a 100644
--- a/llvm/test/Transforms/Inline/inline-invoke-with-asm-call.ll
+++ b/llvm/test/Transforms/Inline/inline-invoke-with-asm-call.ll
@@ -9,8 +9,8 @@ target triple = "x86_64-apple-darwin"
; Make sure we are generating "call asm" instead of "invoke asm".
; CHECK: call void asm
; CHECK-LABEL: @callee_with_asm
-define void @caller() personality ptr @__objc_personality_v0 {
- br i1 undef, label %1, label %4
+define void @caller(i1 %arg) personality ptr @__objc_personality_v0 {
+ br i1 %arg, label %1, label %4
; <label>:1
invoke void @callee_with_asm()
diff --git a/llvm/test/Transforms/Inline/inline_cleanup.ll b/llvm/test/Transforms/Inline/inline_cleanup.ll
index d349e825b69a47..c88fec9489c908 100644
--- a/llvm/test/Transforms/Inline/inline_cleanup.ll
+++ b/llvm/test/Transforms/Inline/inline_cleanup.ll
@@ -138,9 +138,9 @@ entry:
ret void
}
-define void @PR12470_inner(i16 signext %p1) nounwind uwtable {
+define void @PR12470_inner(i16 signext %p1, i1 %arg) nounwind uwtable {
entry:
- br i1 undef, label %cond.true, label %cond.false
+ br i1 %arg, label %cond.true, label %cond.false
cond.true:
br label %cond.end
@@ -161,7 +161,7 @@ if.end5:
ret void
}
-define void @PR12470_outer() {
+define void @PR12470_outer(i1 %arg) {
; This previously crashed during inliner cleanup and folding inner return
; instructions. Check that we don't crash and we produce a function with a single
; return instruction due to merging the returns of the inlined function.
@@ -172,16 +172,16 @@ define void @PR12470_outer() {
; CHECK: }
entry:
- call void @PR12470_inner(i16 signext 1)
+ call void @PR12470_inner(i16 signext 1, i1 1)
ret void
}
-define void @crasher_inner() nounwind uwtable {
+define void @crasher_inner(i1 %arg) nounwind uwtable {
entry:
br i1 false, label %for.end28, label %for.body6
for.body6:
- br i1 undef, label %for.body6, label %for.cond12.for.inc26_crit_edge
+ br i1 %arg, label %for.body6, label %for.cond12.for.inc26_crit_edge
for.cond12.for.inc26_crit_edge:
br label %for.body6.1
@@ -190,13 +190,13 @@ for.end28:
ret void
for.body6.1:
- br i1 undef, label %for.body6.1, label %for.cond12.for.inc26_crit_edge.1
+ br i1 %arg, label %for.body6.1, label %for.cond12.for.inc26_crit_edge.1
for.cond12.for.inc26_crit_edge.1:
br label %for.body6.2
for.body6.2:
- br i1 undef, label %for.body6.2, label %for.cond12.for.inc26_crit_edge.2
+ br i1 %arg, label %for.body6.2, label %for.cond12.for.inc26_crit_edge.2
for.cond12.for.inc26_crit_edge.2:
br label %for.end28
@@ -209,6 +209,6 @@ define void @crasher_outer() {
; CHECK-NOT: ret
; CHECK: }
entry:
- tail call void @crasher_inner()
+ tail call void @crasher_inner(i1 1)
ret void
}
diff --git a/llvm/test/Transforms/Inline/pr33637.ll b/llvm/test/Transforms/Inline/pr33637.ll
index 48c2b4958097ac..907fca79b1ffdc 100644
--- a/llvm/test/Transforms/Inline/pr33637.ll
+++ b/llvm/test/Transforms/Inline/pr33637.ll
@@ -1,13 +1,13 @@
; RUN: opt -passes=inline < %s
-define void @patatino() {
+define void @patatino(i1 %arg) {
for.cond:
br label %for.body
for.body:
%tobool = icmp eq i32 5, 0
%sel = select i1 %tobool, i32 0, i32 2
- br i1 undef, label %cleanup1.thread, label %cleanup1
+ br i1 %arg, label %cleanup1.thread, label %cleanup1
cleanup1.thread:
ret void
diff --git a/llvm/test/Transforms/Inline/pr53206.ll b/llvm/test/Transforms/Inline/pr53206.ll
index e7b2b191ed6ffa..266a7f8083ea2f 100644
--- a/llvm/test/Transforms/Inline/pr53206.ll
+++ b/llvm/test/Transforms/Inline/pr53206.ll
@@ -4,7 +4,7 @@
; Check that the exception handling code is fully pruned, and does not
; leave behind invalid IR.
-define internal void @foo() personality ptr undef {
+define internal void @foo(i1 %arg) personality ptr undef {
entry:
br i1 false, label %join, label %split
@@ -25,7 +25,7 @@ cleanup1:
br label %cleanup1.cont
cleanup1.cont:
- br i1 undef, label %cleanupret, label %invoke2
+ br i1 %arg, label %cleanupret, label %invoke2
invoke2:
invoke void undef() [ "funclet"(token %pad1) ]
@@ -46,6 +46,6 @@ define void @test() personality ptr undef {
; CHECK-LABEL: @test(
; CHECK-NEXT: ret void
;
- call void @foo()
+ call void @foo(i1 1)
ret void
}
>From b3ae9b988b56ef62d1943d24000e9077e95740b7 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Wed, 13 Nov 2024 21:30:36 -0700
Subject: [PATCH 4/6] Remove br i1 undef in InstSimplify directory
---
llvm/test/Transforms/InstSimplify/dead-code-removal.ll | 6 +++---
llvm/test/Transforms/InstSimplify/require-dominator.ll | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/llvm/test/Transforms/InstSimplify/dead-code-removal.ll b/llvm/test/Transforms/InstSimplify/dead-code-removal.ll
index 6358ddfb0e439d..b885c27ea0b08c 100644
--- a/llvm/test/Transforms/InstSimplify/dead-code-removal.ll
+++ b/llvm/test/Transforms/InstSimplify/dead-code-removal.ll
@@ -1,15 +1,15 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=instsimplify -S < %s | FileCheck %s
-define void @foo() nounwind {
+define void @foo(i1 %arg) nounwind {
; CHECK-LABEL: @foo(
-; CHECK-NEXT: br i1 undef, label [[TMP1:%.*]], label [[TMP2:%.*]]
+; CHECK-NEXT: br i1 %arg, label [[TMP1:%.*]], label [[TMP2:%.*]]
; CHECK: 1:
; CHECK-NEXT: br label [[TMP1]]
; CHECK: 2:
; CHECK-NEXT: ret void
;
- br i1 undef, label %1, label %4
+ br i1 %arg, label %1, label %4
; <label>:1 ; preds = %1, %0
%2 = phi i32 [ %3, %1 ], [ undef, %0 ]
diff --git a/llvm/test/Transforms/InstSimplify/require-dominator.ll b/llvm/test/Transforms/InstSimplify/require-dominator.ll
index c0dbba973b80a2..b9c8f5d5f107ff 100644
--- a/llvm/test/Transforms/InstSimplify/require-dominator.ll
+++ b/llvm/test/Transforms/InstSimplify/require-dominator.ll
@@ -7,8 +7,8 @@
target triple = "x86_64-grtev4-linux-gnu"
; Function Attrs: nounwind uwtable
-define void @foo(ptr) #1 align 2 {
- br i1 undef, label %exit, label %2
+define void @foo(ptr, i1 %arg) #1 align 2 {
+ br i1 %arg, label %exit, label %2
; <label>:2:
%3 = tail call ptr @_Znwm(i64 56) #10
>From d0e14a4c8f715fcd2de636f8c41a8abb2386a932 Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Wed, 13 Nov 2024 21:58:52 -0700
Subject: [PATCH 5/6] Fix function argument
---
.../test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
index 6ef0c2b73aab3f..257816650017af 100644
--- a/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
+++ b/llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll
@@ -15,7 +15,7 @@ target datalayout = "n8:16:32:64"
@ptr = common global ptr null, align 8
-define i32 @test1(i1 %arg) {
+define i32 @test1() {
; CHECK-LABEL: @test1(
; CHECK-NEXT: entry:
; CHECK-NEXT: store i32 -1, ptr @idx, align 4
@@ -93,7 +93,7 @@ for.end:
}
-define void @test2(ptr %a, ptr %b, i8 %limit) {
+define void @test2(ptr %a, ptr %b, i8 %limit, i1 %arg) {
; CHECK-LABEL: @test2(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[CONV:%.*]] = zext i8 [[LIMIT:%.*]] to i32
>From a60ee440b7598bca07aa03463d2ee8b117eb5f6d Mon Sep 17 00:00:00 2001
From: Lee <lee10202013 at gmail.com>
Date: Thu, 14 Nov 2024 15:36:07 -0700
Subject: [PATCH 6/6] Fix tests
---
.../IndVarSimplify/2011-10-27-lftrnull.ll | 14 ++++----------
.../IndVarSimplify/lcssa-preservation.ll | 8 +++++---
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll b/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
index 7394dbff78e546..c59d3506a484fc 100644
--- a/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
+++ b/llvm/test/Transforms/IndVarSimplify/2011-10-27-lftrnull.ll
@@ -22,22 +22,18 @@ define void @test(i1 %arg) nounwind {
; CHECK: for.body.lr.ph.i81:
; CHECK-NEXT: br label [[FOR_BODY_I86:%.*]]
; CHECK: for.body.i86:
-; CHECK-NEXT: [[CMP196_I:%.*]] = icmp ult i32 0, undef
-; CHECK-NEXT: br i1 [[CMP196_I]], label [[FOR_BODY21_LR_PH_I:%.*]], label [[FOR_END_I129:%.*]]
+; CHECK-NEXT: br i1 false, label [[FOR_BODY21_LR_PH_I:%.*]], label [[FOR_END_I129:%.*]]
; CHECK: for.body21.lr.ph.i:
; CHECK-NEXT: br label [[FOR_BODY21_I:%.*]]
; CHECK: for.body21.i:
; CHECK-NEXT: [[DESTYPIXELPTR_010_I:%.*]] = phi ptr [ null, [[FOR_BODY21_LR_PH_I]] ], [ [[INCDEC_PTR_I:%.*]], [[IF_END_I126:%.*]] ]
-; CHECK-NEXT: [[X_09_I:%.*]] = phi i32 [ 0, [[FOR_BODY21_LR_PH_I]] ], [ [[INC_I125:%.*]], [[IF_END_I126]] ]
; CHECK-NEXT: br i1 [[ARG]], label [[IF_END_I126]], label [[IF_ELSE_I124:%.*]]
; CHECK: if.else.i124:
; CHECK-NEXT: store i8 undef, ptr [[DESTYPIXELPTR_010_I]], align 1
; CHECK-NEXT: br label [[IF_END_I126]]
; CHECK: if.end.i126:
; CHECK-NEXT: [[INCDEC_PTR_I]] = getelementptr inbounds i8, ptr [[DESTYPIXELPTR_010_I]], i32 1
-; CHECK-NEXT: [[INC_I125]] = add nuw i32 [[X_09_I]], 1
-; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC_I125]], undef
-; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY21_I]], label [[FOR_END_I129_LOOPEXIT:%.*]]
+; CHECK-NEXT: br i1 [[ARG]], label [[FOR_BODY21_I]], label [[FOR_END_I129_LOOPEXIT:%.*]]
; CHECK: for.end.i129.loopexit:
; CHECK-NEXT: br label [[FOR_END_I129]]
; CHECK: for.end.i129:
@@ -65,8 +61,7 @@ for.body.lr.ph.i81: ; preds = %if.then165
br label %for.body.i86
for.body.i86: ; preds = %for.end.i129, %for.body.lr.ph.i81
- %cmp196.i = icmp ult i32 0, undef
- br i1 %cmp196.i, label %for.body21.lr.ph.i, label %for.end.i129
+ br i1 false, label %for.body21.lr.ph.i, label %for.end.i129
for.body21.lr.ph.i: ; preds = %for.body.i86
br label %for.body21.i
@@ -83,8 +78,7 @@ if.else.i124: ; preds = %for.body21.i
if.end.i126: ; preds = %if.else.i124, %for.body21.i
%incdec.ptr.i = getelementptr inbounds i8, ptr %destYPixelPtr.010.i, i32 1
%inc.i125 = add i32 %x.09.i, 1
- %cmp19.i = icmp ult i32 %inc.i125, undef
- br i1 %cmp19.i, label %for.body21.i, label %for.end.i129
+ br i1 %arg, label %for.body21.i, label %for.end.i129
for.end.i129: ; preds = %if.end.i126, %for.body.i86
br i1 %arg, label %for.body.i86, label %while.cond
diff --git a/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll b/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
index 79c806209a888a..9a5e54a91057c9 100644
--- a/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
+++ b/llvm/test/Transforms/IndVarSimplify/lcssa-preservation.ll
@@ -4,7 +4,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-n8:16:32:64"
-define void @PR18642(i32 %x, i1 %arg) {
+define void @PR18642(i32 %x) {
; CHECK-LABEL: @PR18642(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
@@ -15,12 +15,14 @@ define void @PR18642(i32 %x, i1 %arg) {
; CHECK: inner.latch:
; CHECK-NEXT: br i1 true, label [[INNER_HEADER]], label [[EXIT_LOOPEXIT:%.*]]
; CHECK: outer.latch:
-; CHECK-NEXT: br i1 [[ARG:%.*]], label [[OUTER_HEADER]], label [[EXIT_LOOPEXIT1:%.*]]
+; CHECK-NEXT: br i1 false, label [[OUTER_HEADER]], label [[EXIT_LOOPEXIT1:%.*]]
; CHECK: exit.loopexit:
+; CHECK-NEXT: [[INC_LCSSA:%.*]] = phi i32 [ -2147483648, [[INNER_LATCH]] ]
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: exit.loopexit1:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: exit:
+; CHECK-NEXT: [[EXIT_PHI:%.*]] = phi i32 [ [[INC_LCSSA]], [[EXIT_LOOPEXIT]] ], [ undef, [[EXIT_LOOPEXIT1]] ]
; CHECK-NEXT: ret void
;
entry:
@@ -41,7 +43,7 @@ inner.latch:
br i1 %cmp2, label %inner.header, label %exit
outer.latch:
- br i1 %arg, label %outer.header, label %exit
+ br i1 false, label %outer.header, label %exit
exit:
%exit.phi = phi i32 [ %inc, %inner.latch ], [ undef, %outer.latch ]
More information about the llvm-commits
mailing list