xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/2011-04-27-IfCvtBug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7-apple-ios
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; If converter was being too cute. It look for root BBs (which don't have
4*9880d681SAndroid Build Coastguard Worker; successors) and use inverse depth first search to traverse the BBs. However
5*9880d681SAndroid Build Coastguard Worker; that doesn't work when the CFG has infinite loops. Simply do a linear
6*9880d681SAndroid Build Coastguard Worker; traversal of all BBs work just fine.
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; rdar://9344645
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker%struct.hc = type { i32, i32, i32, i32 }
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine i32 @t(i32 %type) optsize {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %if.then, label %if.else
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerif.then:
17*9880d681SAndroid Build Coastguard Worker  unreachable
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerif.else:
20*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %if.then15, label %if.else18
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerif.then15:
23*9880d681SAndroid Build Coastguard Worker  unreachable
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerif.else18:
26*9880d681SAndroid Build Coastguard Worker  switch i32 %type, label %if.else173 [
27*9880d681SAndroid Build Coastguard Worker    i32 3, label %if.then115
28*9880d681SAndroid Build Coastguard Worker    i32 1, label %if.then102
29*9880d681SAndroid Build Coastguard Worker  ]
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerif.then102:
32*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %cond.true10.i, label %t.exit
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workercond.true10.i:
35*9880d681SAndroid Build Coastguard Worker  br label %t.exit
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workert.exit:
38*9880d681SAndroid Build Coastguard Worker  unreachable
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Workerif.then115:
41*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %if.else163, label %if.else145
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerif.else145:
44*9880d681SAndroid Build Coastguard Worker  %call150 = call fastcc %struct.hc* @foo(%struct.hc* undef, i32 34865152) optsize
45*9880d681SAndroid Build Coastguard Worker  br label %while.body172
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerif.else163:
48*9880d681SAndroid Build Coastguard Worker  %call168 = call fastcc %struct.hc* @foo(%struct.hc* undef, i32 34078720) optsize
49*9880d681SAndroid Build Coastguard Worker  br label %while.body172
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerwhile.body172:
52*9880d681SAndroid Build Coastguard Worker  br label %while.body172
53*9880d681SAndroid Build Coastguard Worker
54*9880d681SAndroid Build Coastguard Workerif.else173:
55*9880d681SAndroid Build Coastguard Worker  ret i32 -1
56*9880d681SAndroid Build Coastguard Worker}
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Workerdeclare hidden fastcc %struct.hc* @foo(%struct.hc* nocapture, i32) nounwind optsize
59*9880d681SAndroid Build Coastguard Worker
60