• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loop-simplify -lcssa -verify-loop-info -verify-dom-info -S \
2; RUN:   | grep -F {indirectbr i8* %x, \[label %L0, label %L1\]} \
3; RUN:   | count 6
4
5; LoopSimplify should not try to transform loops when indirectbr is involved.
6
7define void @entry(i8* %x) {
8entry:
9  indirectbr i8* %x, [ label %L0, label %L1 ]
10
11L0:
12  br label %L0
13
14L1:
15  ret void
16}
17
18define void @backedge(i8* %x) {
19entry:
20  br label %L0
21
22L0:
23  br label %L1
24
25L1:
26  indirectbr i8* %x, [ label %L0, label %L1 ]
27}
28
29define i64 @exit(i8* %x) {
30entry:
31  br label %L2
32
33L2:
34  %z = bitcast i64 0 to i64
35  indirectbr i8* %x, [ label %L0, label %L1 ]
36
37L0:
38  br label %L2
39
40L1:
41  ret i64 %z
42}
43
44define i64 @criticalexit(i8* %x, i1 %a) {
45entry:
46  br i1 %a, label %L1, label %L2
47
48L2:
49  %z = bitcast i64 0 to i64
50  indirectbr i8* %x, [ label %L0, label %L1 ]
51
52L0:
53  br label %L2
54
55L1:
56  %y = phi i64 [ %z, %L2 ], [ 1, %entry ]
57  ret i64 %y
58}
59
60define i64 @exit_backedge(i8* %x) {
61entry:
62  br label %L0
63
64L0:
65  %z = bitcast i64 0 to i64
66  indirectbr i8* %x, [ label %L0, label %L1 ]
67
68L1:
69  ret i64 %z
70}
71
72define i64 @criticalexit_backedge(i8* %x, i1 %a) {
73entry:
74  br i1 %a, label %L0, label %L1
75
76L0:
77  %z = bitcast i64 0 to i64
78  indirectbr i8* %x, [ label %L0, label %L1 ]
79
80L1:
81  %y = phi i64 [ %z, %L0 ], [ 1, %entry ]
82  ret i64 %y
83}
84
85define void @pr5502() nounwind {
86entry:
87  br label %while.cond
88
89while.cond:
90  br i1 undef, label %while.body, label %while.end
91
92while.body:
93  indirectbr i8* undef, [label %end_opcode, label %end_opcode]
94
95end_opcode:
96  br i1 false, label %end_opcode, label %while.cond
97
98while.end:
99  ret void
100}
101