Skip to content

Commit ab7ec90

Browse files
committed
Remove br i1 undef in SimpleLoopUnswitch directory
1 parent 4537b6e commit ab7ec90

File tree

8 files changed

+62
-36
lines changed

8 files changed

+62
-36
lines changed

llvm/test/Transforms/SimpleLoopUnswitch/2011-06-02-CritSwitch.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
; RUN: opt -passes=simple-loop-unswitch -verify-memoryssa -disable-output < %s
22
; PR10031
33

4-
define i32 @test(i32 %command) {
4+
define i32 @test(i32 %command, i1 %arg) {
55
entry:
66
br label %tailrecurse
77

88
tailrecurse: ; preds = %if.then14, %tailrecurse, %entry
9-
br i1 undef, label %if.then, label %tailrecurse
9+
br i1 %arg, label %if.then, label %tailrecurse
1010

1111
if.then: ; preds = %tailrecurse
1212
switch i32 %command, label %sw.bb [
@@ -15,7 +15,7 @@ if.then: ; preds = %tailrecurse
1515
]
1616

1717
land.lhs.true: ; preds = %if.then, %if.then
18-
br i1 undef, label %sw.bb, label %if.then14
18+
br i1 %arg, label %sw.bb, label %if.then14
1919

2020
if.then14: ; preds = %land.lhs.true
2121
switch i32 %command, label %tailrecurse [

llvm/test/Transforms/SimpleLoopUnswitch/2012-04-30-LoopUnswitch-LPad-Crash.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ target triple = "x86_64-apple-macosx10.7.0"
88
%class.B.21.41.65.101.137.157.177.197.237.241.245.249.261.293.301.337.345.378 = type { ptr }
99
%class.A.20.40.64.100.136.156.176.196.236.240.244.248.260.292.300.336.344.377 = type { i8 }
1010

11-
define void @_Z23get_reconstruction_pathv() uwtable ssp personality ptr @__gxx_personality_v0 {
11+
define void @_Z23get_reconstruction_pathv(i1 %arg) uwtable ssp personality ptr @__gxx_personality_v0 {
1212
entry:
1313
%c = alloca %class.D.22.42.66.102.138.158.178.198.238.242.246.250.262.294.302.338.346.379, align 8
1414
br label %for.cond
@@ -30,7 +30,7 @@ invoke.cont4: ; preds = %for.cond3
3030
to label %invoke.cont6 unwind label %lpad
3131

3232
invoke.cont6: ; preds = %invoke.cont4
33-
br i1 undef, label %for.cond3, label %for.end
33+
br i1 %arg, label %for.cond3, label %for.end
3434

3535
lpad: ; preds = %for.end, %invoke.cont4, %for.cond3, %invoke.cont, %for.cond
3636
%0 = landingpad { ptr, i32 }

llvm/test/Transforms/SimpleLoopUnswitch/2015-09-18-Addrspace.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
target datalayout = "e-m:e-p:16:16-p1:32:16-i32:16-i64:16-n8:16"
88

9-
define void @foo() {
9+
define void @foo(i1 %arg) {
1010
; CHECK-LABEL: @foo
1111
entry:
1212
%arrayidx.i1 = getelementptr inbounds i16, ptr undef, i16 undef
1313
%arrayidx.i = addrspacecast ptr %arrayidx.i1 to ptr addrspace(1)
14-
br i1 undef, label %for.body.i, label %bar.exit
14+
br i1 %arg, label %for.body.i, label %bar.exit
1515

1616
for.body.i: ; preds = %for.body.i, %entry
1717
; When we call makeLoopInvariant (i.e. trivial LICM) on this load, it

llvm/test/Transforms/SimpleLoopUnswitch/delete-dead-blocks.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
declare void @foo()
77

88
; CHECK-LABEL: @Test
9-
define void @Test(i32) {
9+
define void @Test(i32, i1 %arg) {
1010
entry:
1111
br label %outer
1212
outer:
@@ -47,7 +47,7 @@ get_out2:
4747
;
4848
; This comes from PR38778
4949
; CHECK-LABEL: @Test2
50-
define void @Test2(i32) {
50+
define void @Test2(i32, i1 %arg) {
5151
header:
5252
br label %loop
5353
loop:
@@ -58,12 +58,12 @@ loop:
5858
]
5959
; CHECK-NOT: {{^}}guarded1:
6060
guarded1:
61-
br i1 undef, label %continue, label %leave
61+
br i1 %arg, label %continue, label %leave
6262
guarded2:
6363
br label %continue
6464
check:
6565
%val = add i32 0, 1
66-
br i1 undef, label %continue, label %leave
66+
br i1 %arg, label %continue, label %leave
6767
continue:
6868
br label %loop
6969
leave:
@@ -75,7 +75,7 @@ leave:
7575
; Yet another test from PR38778
7676
;
7777
; CHECK-LABEL: @Test3
78-
define void @Test3(i32) {
78+
define void @Test3(i32, i1 %arg) {
7979
header:
8080
br label %outer
8181
outer:
@@ -95,7 +95,7 @@ case2:
9595
br label %continue
9696
continue:
9797
%local_11_92 = phi i32 [ 0, %switchme ], [ 18, %case2 ], [ 0, %overflow ]
98-
br i1 undef, label %outer, label %inner
98+
br i1 %arg, label %outer, label %inner
9999
go_out:
100100
unreachable
101101
}

llvm/test/Transforms/SimpleLoopUnswitch/formDedicatedAfterTrivial1.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
; PR38283
44
; PR38737
5-
define void @f1() {
5+
define void @f1(i1 %arg) {
66
for.cond1thread-pre-split.lr.ph.lr.ph:
77
%tobool4 = icmp eq i16 undef, 0
88
br label %for.cond1thread-pre-split
@@ -18,7 +18,7 @@ if.end: ; preds = %for.body2
1818
br i1 %tobool4, label %if.end6, label %for.cond1thread-pre-split
1919

2020
if.end6: ; preds = %if.end
21-
br i1 undef, label %for.body2, label %for.end
21+
br i1 %arg, label %for.body2, label %for.end
2222

2323
for.end: ; preds = %if.end6, %for.body2
2424
ret void

llvm/test/Transforms/SimpleLoopUnswitch/guards.ll

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --version 5
12
; RUN: opt -passes='loop(simple-loop-unswitch<nontrivial>),verify<loops>' -simple-loop-unswitch-guards -S < %s | FileCheck %s
23
; RUN: opt -passes='simple-loop-unswitch<nontrivial>' -simple-loop-unswitch-guards -S < %s | FileCheck %s
34
; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>),verify<loops>' -simple-loop-unswitch-guards -verify-memoryssa -verify-loop-info -S < %s | FileCheck %s
@@ -131,30 +132,55 @@ exit:
131132
ret void
132133
}
133134

134-
define void @test_nested_loop(i1 %cond, i32 %N) {
135-
; CHECK-LABEL: @test_nested_loop(
135+
define void @test_nested_loop(i1 %cond, i32 %N, i1 %arg) {
136+
; CHECK-LABEL: define void @test_nested_loop(i1 %cond, i32 %N, i1 %arg) {
136137
; CHECK-NEXT: entry:
137-
; CHECK-NEXT: br i1 [[COND:%.*]], label [[ENTRY_SPLIT:%.*]], label [[OUTER_LOOP_SPLIT:%.*]]
138+
; CHECK-NEXT: br i1 %cond, label %entry.split, label %outer_loop.split
138139
; CHECK: entry.split:
139-
; CHECK-NEXT: br label [[OUTER_LOOP:%.*]]
140+
; CHECK-NEXT: br i1 %arg, label %entry.split.split.us, label %entry.split.split
141+
; CHECK: entry.split.split.us:
142+
; CHECK-NEXT: br label %outer_loop.us
143+
; CHECK: outer_loop.us:
144+
; CHECK-NEXT: br label %outer_loop.split.us.us
145+
; CHECK: outer_backedge.us:
146+
; CHECK-NEXT: br label %outer_loop.us
147+
; CHECK: outer_loop.split.us.us:
148+
; CHECK-NEXT: br label %loop.us.us
149+
; CHECK: loop.us.us:
150+
; CHECK-NEXT: %iv.us.us = phi i32 [ 0, %outer_loop.split.us.us ], [ %iv.next.us.us, %guarded.us.us ]
151+
; CHECK-NEXT: br label %guarded.us.us
152+
; CHECK: guarded.us.us:
153+
; CHECK-NEXT: %iv.next.us.us = add i32 %iv.us.us, 1
154+
; CHECK-NEXT: %loop.cond.us.us = icmp slt i32 %iv.next.us.us, %N
155+
; CHECK-NEXT: br i1 %loop.cond.us.us, label %loop.us.us, label %outer_backedge.split.us.us
156+
; CHECK: outer_backedge.split.us.us:
157+
; CHECK-NEXT: br label %outer_backedge.us
158+
; CHECK: entry.split.split:
159+
; CHECK-NEXT: br label %outer_loop
140160
; CHECK: outer_loop:
141-
; CHECK-NEXT: br label [[OUTER_LOOP_SPLIT_US:%.*]]
161+
; CHECK-NEXT: br label %outer_loop.split.us
142162
; CHECK: outer_loop.split.us:
143-
; CHECK-NEXT: br label [[LOOP_US:%.*]]
163+
; CHECK-NEXT: br label %loop.us
144164
; CHECK: loop.us:
145-
; CHECK-NEXT: [[IV_US:%.*]] = phi i32 [ 0, [[OUTER_LOOP_SPLIT_US]] ], [ [[IV_NEXT_US:%.*]], [[GUARDED_US:%.*]] ]
146-
; CHECK-NEXT: br label [[GUARDED_US]]
165+
; CHECK-NEXT: %iv.us = phi i32 [ 0, %outer_loop.split.us ], [ %iv.next.us, %guarded.us ]
166+
; CHECK-NEXT: br label %guarded.us
147167
; CHECK: guarded.us:
148-
; CHECK-NEXT: [[IV_NEXT_US]] = add i32 [[IV_US]], 1
149-
; CHECK-NEXT: [[LOOP_COND_US:%.*]] = icmp slt i32 [[IV_NEXT_US]], [[N:%.*]]
150-
; CHECK-NEXT: br i1 [[LOOP_COND_US]], label [[LOOP_US]], label [[OUTER_BACKEDGE_SPLIT_US:%.*]]
168+
; CHECK-NEXT: %iv.next.us = add i32 %iv.us, 1
169+
; CHECK-NEXT: %loop.cond.us = icmp slt i32 %iv.next.us, %N
170+
; CHECK-NEXT: br i1 %loop.cond.us, label %loop.us, label %outer_backedge.split.us
151171
; CHECK: outer_backedge.split.us:
152-
; CHECK-NEXT: br label [[OUTER_BACKEDGE:%.*]]
172+
; CHECK-NEXT: br label %outer_backedge
173+
; CHECK: outer_loop.split:
174+
; CHECK-NEXT: br label %loop
175+
; CHECK: loop:
176+
; CHECK-NEXT: br label %deopt
153177
; CHECK: deopt:
154178
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 false) [ "deopt"() ]
155179
; CHECK-NEXT: unreachable
156180
; CHECK: outer_backedge:
157-
; CHECK-NEXT: br i1 false, label [[OUTER_LOOP]], label [[EXIT:%.*]]
181+
; CHECK-NEXT: br label %exit
182+
; CHECK: exit:
183+
; CHECK-NEXT: ret void
158184
;
159185

160186
entry:
@@ -171,7 +197,7 @@ loop:
171197
br i1 %loop.cond, label %loop, label %outer_backedge
172198

173199
outer_backedge:
174-
br i1 undef, label %outer_loop, label %exit
200+
br i1 %arg, label %outer_loop, label %exit
175201

176202
exit:
177203
ret void

llvm/test/Transforms/SimpleLoopUnswitch/pr37888.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if.end:
2929
br label %for.inc
3030

3131
for.inc:
32-
br i1 undef, label %for.body, label %for.end
32+
br i1 false, label %for.body, label %for.end
3333

3434
for.end:
3535
ret void

llvm/test/Transforms/SimpleLoopUnswitch/preserve-analyses.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ bb10: ; preds = %bb8, %bb
7474
; This is a simplified form of ineqn from above. It triggers some
7575
; different cases in the loop-unswitch code.
7676

77-
define void @simplified_ineqn() nounwind readonly {
77+
define void @simplified_ineqn(i1 %arg) nounwind readonly {
7878
entry:
7979
br label %bb8.outer
8080

8181
bb8.outer: ; preds = %bb6, %bb2, %entry
8282
%x = phi i32 [ 0, %entry ], [ 0, %bb6 ], [ 1, %bb2 ] ; <i32> [#uses=1]
83-
br i1 undef, label %return, label %bb2
83+
br i1 %arg, label %return, label %bb2
8484

8585
bb2: ; preds = %bb
8686
switch i32 %x, label %bb6 [
8787
i32 0, label %bb8.outer
8888
]
8989

9090
bb6: ; preds = %bb2
91-
br i1 undef, label %bb8.outer, label %bb2
91+
br i1 %arg, label %bb8.outer, label %bb2
9292

9393
return: ; preds = %bb8, %bb
9494
ret void
@@ -97,17 +97,17 @@ return: ; preds = %bb8, %bb
9797
; This function requires special handling to preserve LCSSA form.
9898
; PR4934
9999

100-
define void @pnp_check_irq() nounwind noredzone {
100+
define void @pnp_check_irq(i1 %arg) nounwind noredzone {
101101
entry:
102102
%conv56 = trunc i64 undef to i32 ; <i32> [#uses=1]
103103
br label %while.cond.i
104104

105105
while.cond.i: ; preds = %while.cond.i.backedge, %entry
106106
%call.i25 = call ptr @pci_get_device() nounwind noredzone ; <ptr> [#uses=2]
107-
br i1 undef, label %if.then65, label %while.body.i
107+
br i1 %arg, label %if.then65, label %while.body.i
108108

109109
while.body.i: ; preds = %while.cond.i
110-
br i1 undef, label %if.then31.i.i, label %while.cond.i.backedge
110+
br i1 %arg, label %if.then31.i.i, label %while.cond.i.backedge
111111

112112
while.cond.i.backedge: ; preds = %if.then31.i.i, %while.body.i
113113
br label %while.cond.i

0 commit comments

Comments
 (0)