xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/switch-simplify-crash.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -simplifycfg -disable-output
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdefine void @NewExtractNames() {
4*9880d681SAndroid Build Coastguard Workerentry:
5*9880d681SAndroid Build Coastguard Worker	br i1 false, label %endif.0, label %then.0
6*9880d681SAndroid Build Coastguard Workerthen.0:		; preds = %entry
7*9880d681SAndroid Build Coastguard Worker	br i1 false, label %shortcirc_next.i, label %shortcirc_done.i
8*9880d681SAndroid Build Coastguard Workershortcirc_next.i:		; preds = %then.0
9*9880d681SAndroid Build Coastguard Worker	br label %shortcirc_done.i
10*9880d681SAndroid Build Coastguard Workershortcirc_done.i:		; preds = %shortcirc_next.i, %then.0
11*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.0.i, label %else.0.i
12*9880d681SAndroid Build Coastguard Workerthen.0.i:		; preds = %shortcirc_done.i
13*9880d681SAndroid Build Coastguard Worker	br label %NewBase.exit
14*9880d681SAndroid Build Coastguard Workerelse.0.i:		; preds = %shortcirc_done.i
15*9880d681SAndroid Build Coastguard Worker	br i1 false, label %endif.0.i, label %else.1.i
16*9880d681SAndroid Build Coastguard Workerelse.1.i:		; preds = %else.0.i
17*9880d681SAndroid Build Coastguard Worker	br i1 false, label %endif.0.i, label %else.2.i
18*9880d681SAndroid Build Coastguard Workerelse.2.i:		; preds = %else.1.i
19*9880d681SAndroid Build Coastguard Worker	br label %NewBase.exit
20*9880d681SAndroid Build Coastguard Workerendif.0.i:		; preds = %else.1.i, %else.0.i
21*9880d681SAndroid Build Coastguard Worker	br label %NewBase.exit
22*9880d681SAndroid Build Coastguard WorkerNewBase.exit:		; preds = %endif.0.i, %else.2.i, %then.0.i
23*9880d681SAndroid Build Coastguard Worker	br label %endif.0
24*9880d681SAndroid Build Coastguard Workerendif.0:		; preds = %NewBase.exit, %entry
25*9880d681SAndroid Build Coastguard Worker	%tmp.32.mask = and i32 0, 31		; <i32> [#uses=1]
26*9880d681SAndroid Build Coastguard Worker	switch i32 %tmp.32.mask, label %label.9 [
27*9880d681SAndroid Build Coastguard Worker		 i32 16, label %loopentry.2
28*9880d681SAndroid Build Coastguard Worker		 i32 15, label %loopentry.2
29*9880d681SAndroid Build Coastguard Worker		 i32 14, label %loopentry.2
30*9880d681SAndroid Build Coastguard Worker		 i32 13, label %loopentry.2
31*9880d681SAndroid Build Coastguard Worker		 i32 10, label %loopentry.2
32*9880d681SAndroid Build Coastguard Worker		 i32 20, label %loopentry.1
33*9880d681SAndroid Build Coastguard Worker		 i32 19, label %loopentry.1
34*9880d681SAndroid Build Coastguard Worker		 i32 2, label %loopentry.0
35*9880d681SAndroid Build Coastguard Worker		 i32 0, label %switchexit
36*9880d681SAndroid Build Coastguard Worker	]
37*9880d681SAndroid Build Coastguard Workerloopentry.0:		; preds = %endif.1, %endif.0
38*9880d681SAndroid Build Coastguard Worker	br i1 false, label %no_exit.0, label %switchexit
39*9880d681SAndroid Build Coastguard Workerno_exit.0:		; preds = %loopentry.0
40*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.1, label %else.1
41*9880d681SAndroid Build Coastguard Workerthen.1:		; preds = %no_exit.0
42*9880d681SAndroid Build Coastguard Worker	br label %endif.1
43*9880d681SAndroid Build Coastguard Workerelse.1:		; preds = %no_exit.0
44*9880d681SAndroid Build Coastguard Worker	br i1 false, label %shortcirc_next.0, label %shortcirc_done.0
45*9880d681SAndroid Build Coastguard Workershortcirc_next.0:		; preds = %else.1
46*9880d681SAndroid Build Coastguard Worker	br label %shortcirc_done.0
47*9880d681SAndroid Build Coastguard Workershortcirc_done.0:		; preds = %shortcirc_next.0, %else.1
48*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.2, label %endif.2
49*9880d681SAndroid Build Coastguard Workerthen.2:		; preds = %shortcirc_done.0
50*9880d681SAndroid Build Coastguard Worker	br label %endif.2
51*9880d681SAndroid Build Coastguard Workerendif.2:		; preds = %then.2, %shortcirc_done.0
52*9880d681SAndroid Build Coastguard Worker	br label %endif.1
53*9880d681SAndroid Build Coastguard Workerendif.1:		; preds = %endif.2, %then.1
54*9880d681SAndroid Build Coastguard Worker	br label %loopentry.0
55*9880d681SAndroid Build Coastguard Workerloopentry.1:		; preds = %endif.3, %endif.0, %endif.0
56*9880d681SAndroid Build Coastguard Worker	br i1 false, label %no_exit.1, label %switchexit
57*9880d681SAndroid Build Coastguard Workerno_exit.1:		; preds = %loopentry.1
58*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.3, label %else.2
59*9880d681SAndroid Build Coastguard Workerthen.3:		; preds = %no_exit.1
60*9880d681SAndroid Build Coastguard Worker	br label %endif.3
61*9880d681SAndroid Build Coastguard Workerelse.2:		; preds = %no_exit.1
62*9880d681SAndroid Build Coastguard Worker	br i1 false, label %shortcirc_next.1, label %shortcirc_done.1
63*9880d681SAndroid Build Coastguard Workershortcirc_next.1:		; preds = %else.2
64*9880d681SAndroid Build Coastguard Worker	br label %shortcirc_done.1
65*9880d681SAndroid Build Coastguard Workershortcirc_done.1:		; preds = %shortcirc_next.1, %else.2
66*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.4, label %endif.4
67*9880d681SAndroid Build Coastguard Workerthen.4:		; preds = %shortcirc_done.1
68*9880d681SAndroid Build Coastguard Worker	br label %endif.4
69*9880d681SAndroid Build Coastguard Workerendif.4:		; preds = %then.4, %shortcirc_done.1
70*9880d681SAndroid Build Coastguard Worker	br label %endif.3
71*9880d681SAndroid Build Coastguard Workerendif.3:		; preds = %endif.4, %then.3
72*9880d681SAndroid Build Coastguard Worker	br label %loopentry.1
73*9880d681SAndroid Build Coastguard Workerloopentry.2:		; preds = %endif.5, %endif.0, %endif.0, %endif.0, %endif.0, %endif.0
74*9880d681SAndroid Build Coastguard Worker	%i.3 = phi i32 [ 0, %endif.5 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ]		; <i32> [#uses=1]
75*9880d681SAndroid Build Coastguard Worker	%tmp.158 = icmp slt i32 %i.3, 0		; <i1> [#uses=1]
76*9880d681SAndroid Build Coastguard Worker	br i1 %tmp.158, label %no_exit.2, label %switchexit
77*9880d681SAndroid Build Coastguard Workerno_exit.2:		; preds = %loopentry.2
78*9880d681SAndroid Build Coastguard Worker	br i1 false, label %shortcirc_next.2, label %shortcirc_done.2
79*9880d681SAndroid Build Coastguard Workershortcirc_next.2:		; preds = %no_exit.2
80*9880d681SAndroid Build Coastguard Worker	br label %shortcirc_done.2
81*9880d681SAndroid Build Coastguard Workershortcirc_done.2:		; preds = %shortcirc_next.2, %no_exit.2
82*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.5, label %endif.5
83*9880d681SAndroid Build Coastguard Workerthen.5:		; preds = %shortcirc_done.2
84*9880d681SAndroid Build Coastguard Worker	br label %endif.5
85*9880d681SAndroid Build Coastguard Workerendif.5:		; preds = %then.5, %shortcirc_done.2
86*9880d681SAndroid Build Coastguard Worker	br label %loopentry.2
87*9880d681SAndroid Build Coastguard Workerlabel.9:		; preds = %endif.0
88*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.6, label %endif.6
89*9880d681SAndroid Build Coastguard Workerthen.6:		; preds = %label.9
90*9880d681SAndroid Build Coastguard Worker	br label %endif.6
91*9880d681SAndroid Build Coastguard Workerendif.6:		; preds = %then.6, %label.9
92*9880d681SAndroid Build Coastguard Worker	store i32 0, i32* null
93*9880d681SAndroid Build Coastguard Worker	br label %switchexit
94*9880d681SAndroid Build Coastguard Workerswitchexit:		; preds = %endif.6, %loopentry.2, %loopentry.1, %loopentry.0, %endif.0
95*9880d681SAndroid Build Coastguard Worker	br i1 false, label %endif.7, label %then.7
96*9880d681SAndroid Build Coastguard Workerthen.7:		; preds = %switchexit
97*9880d681SAndroid Build Coastguard Worker	br i1 false, label %shortcirc_next.3, label %shortcirc_done.3
98*9880d681SAndroid Build Coastguard Workershortcirc_next.3:		; preds = %then.7
99*9880d681SAndroid Build Coastguard Worker	br label %shortcirc_done.3
100*9880d681SAndroid Build Coastguard Workershortcirc_done.3:		; preds = %shortcirc_next.3, %then.7
101*9880d681SAndroid Build Coastguard Worker	br i1 false, label %then.8, label %endif.8
102*9880d681SAndroid Build Coastguard Workerthen.8:		; preds = %shortcirc_done.3
103*9880d681SAndroid Build Coastguard Worker	br label %endif.8
104*9880d681SAndroid Build Coastguard Workerendif.8:		; preds = %then.8, %shortcirc_done.3
105*9880d681SAndroid Build Coastguard Worker	br label %endif.7
106*9880d681SAndroid Build Coastguard Workerendif.7:		; preds = %endif.8, %switchexit
107*9880d681SAndroid Build Coastguard Worker	ret void
108*9880d681SAndroid Build Coastguard Worker}
109