1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=dfa-jump-threading %s | FileCheck %s
4 ; These tests check that the DFA jump threading transformation is applied
5 ; properly to two CFGs. It checks that blocks are cloned, branches are updated,
6 ; and SSA form is restored.
7 define i32 @test1(i32 %num) {
10 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
12 ; CHECK-NEXT: [[COUNT:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]
13 ; CHECK-NEXT: [[STATE:%.*]] = phi i32 [ 1, [[ENTRY]] ], [ [[STATE_NEXT:%.*]], [[FOR_INC]] ]
14 ; CHECK-NEXT: switch i32 [[STATE]], label [[FOR_INC_JT1:%.*]] [
15 ; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
16 ; CHECK-NEXT: i32 2, label [[CASE2:%.*]]
18 ; CHECK: for.body.jt2:
19 ; CHECK-NEXT: [[COUNT_JT2:%.*]] = phi i32 [ [[INC_JT2:%.*]], [[FOR_INC_JT2:%.*]] ]
20 ; CHECK-NEXT: [[STATE_JT2:%.*]] = phi i32 [ [[STATE_NEXT_JT2:%.*]], [[FOR_INC_JT2]] ]
21 ; CHECK-NEXT: br label [[CASE2]]
22 ; CHECK: for.body.jt1:
23 ; CHECK-NEXT: [[COUNT_JT1:%.*]] = phi i32 [ [[INC_JT1:%.*]], [[FOR_INC_JT1]] ]
24 ; CHECK-NEXT: [[STATE_JT1:%.*]] = phi i32 [ [[STATE_NEXT_JT1:%.*]], [[FOR_INC_JT1]] ]
25 ; CHECK-NEXT: br label [[CASE1]]
27 ; CHECK-NEXT: [[COUNT2:%.*]] = phi i32 [ [[COUNT_JT1]], [[FOR_BODY_JT1:%.*]] ], [ [[COUNT]], [[FOR_BODY]] ]
28 ; CHECK-NEXT: br label [[FOR_INC_JT2]]
30 ; CHECK-NEXT: [[COUNT1:%.*]] = phi i32 [ [[COUNT_JT2]], [[FOR_BODY_JT2:%.*]] ], [ [[COUNT]], [[FOR_BODY]] ]
31 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[COUNT1]], 50
32 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_INC_JT1]], label [[SEL_SI_UNFOLD_FALSE_JT2:%.*]]
33 ; CHECK: sel.si.unfold.false:
34 ; CHECK-NEXT: br label [[FOR_INC]]
35 ; CHECK: sel.si.unfold.false.jt2:
36 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI_JT2:%.*]] = phi i32 [ 2, [[CASE2]] ]
37 ; CHECK-NEXT: br label [[FOR_INC_JT2]]
39 ; CHECK-NEXT: [[STATE_NEXT]] = phi i32 [ poison, [[SEL_SI_UNFOLD_FALSE:%.*]] ]
40 ; CHECK-NEXT: [[INC]] = add nsw i32 undef, 1
41 ; CHECK-NEXT: [[CMP_EXIT:%.*]] = icmp slt i32 [[INC]], [[NUM:%.*]]
42 ; CHECK-NEXT: br i1 [[CMP_EXIT]], label [[FOR_BODY]], label [[FOR_END:%.*]]
44 ; CHECK-NEXT: [[COUNT4:%.*]] = phi i32 [ [[COUNT1]], [[SEL_SI_UNFOLD_FALSE_JT2]] ], [ [[COUNT2]], [[CASE1]] ]
45 ; CHECK-NEXT: [[STATE_NEXT_JT2]] = phi i32 [ 2, [[CASE1]] ], [ [[DOTSI_UNFOLD_PHI_JT2]], [[SEL_SI_UNFOLD_FALSE_JT2]] ]
46 ; CHECK-NEXT: [[INC_JT2]] = add nsw i32 [[COUNT4]], 1
47 ; CHECK-NEXT: [[CMP_EXIT_JT2:%.*]] = icmp slt i32 [[INC_JT2]], [[NUM]]
48 ; CHECK-NEXT: br i1 [[CMP_EXIT_JT2]], label [[FOR_BODY_JT2]], label [[FOR_END]]
50 ; CHECK-NEXT: [[COUNT3:%.*]] = phi i32 [ [[COUNT]], [[FOR_BODY]] ], [ [[COUNT1]], [[CASE2]] ]
51 ; CHECK-NEXT: [[STATE_NEXT_JT1]] = phi i32 [ 1, [[CASE2]] ], [ 1, [[FOR_BODY]] ]
52 ; CHECK-NEXT: [[INC_JT1]] = add nsw i32 [[COUNT3]], 1
53 ; CHECK-NEXT: [[CMP_EXIT_JT1:%.*]] = icmp slt i32 [[INC_JT1]], [[NUM]]
54 ; CHECK-NEXT: br i1 [[CMP_EXIT_JT1]], label [[FOR_BODY_JT1]], label [[FOR_END]]
56 ; CHECK-NEXT: ret i32 0
62 %count = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
63 %state = phi i32 [ 1, %entry ], [ %state.next, %for.inc ]
64 switch i32 %state, label %for.inc [
73 %cmp = icmp eq i32 %count, 50
74 %sel = select i1 %cmp, i32 1, i32 2
78 %state.next = phi i32 [ %sel, %case2 ], [ 1, %for.body ], [ 2, %case1 ]
79 %inc = add nsw i32 %count, 1
80 %cmp.exit = icmp slt i32 %inc, %num
81 br i1 %cmp.exit, label %for.body, label %for.end
88 define i32 @test2(i32 %init) {
89 ; CHECK-LABEL: @test2(
91 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[INIT:%.*]], 0
92 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_1:%.*]], label [[SEL_SI_UNFOLD_FALSE:%.*]]
93 ; CHECK: state.1.be2.si.unfold.false:
94 ; CHECK-NEXT: [[STATE_1_BE_SI_UNFOLD_PHI:%.*]] = phi i32 [ poison, [[LOOP_1_BACKEDGE:%.*]] ]
95 ; CHECK-NEXT: br label [[LOOP_1]]
96 ; CHECK: state.1.be2.si.unfold.false.jt4:
97 ; CHECK-NEXT: [[STATE_1_BE_SI_UNFOLD_PHI_JT4:%.*]] = phi i32 [ [[STATE_1_BE_JT4:%.*]], [[LOOP_1_BACKEDGE_JT4:%.*]] ]
98 ; CHECK-NEXT: br label [[LOOP_1_JT4:%.*]]
99 ; CHECK: state.1.be2.si.unfold.false.jt2:
100 ; CHECK-NEXT: [[STATE_1_BE_SI_UNFOLD_PHI_JT2:%.*]] = phi i32 [ [[STATE_1_BE_JT2:%.*]], [[LOOP_1_BACKEDGE_JT2:%.*]] ]
101 ; CHECK-NEXT: br label [[LOOP_1_JT2:%.*]]
102 ; CHECK: sel.si.unfold.false:
103 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI:%.*]] = phi i32 [ 2, [[ENTRY:%.*]] ]
104 ; CHECK-NEXT: br label [[LOOP_1]]
106 ; CHECK-NEXT: [[STATE_1:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[STATE_1_BE_SI_UNFOLD_PHI]], [[STATE_1_BE2_SI_UNFOLD_FALSE:%.*]] ], [ [[DOTSI_UNFOLD_PHI]], [[SEL_SI_UNFOLD_FALSE]] ]
107 ; CHECK-NEXT: br label [[LOOP_2:%.*]]
109 ; CHECK-NEXT: [[STATE_1_JT4:%.*]] = phi i32 [ [[STATE_1_BE_SI_UNFOLD_PHI_JT4]], [[STATE_1_BE2_SI_UNFOLD_FALSE_JT4:%.*]] ]
110 ; CHECK-NEXT: br label [[LOOP_2_JT4:%.*]]
112 ; CHECK-NEXT: [[STATE_1_JT2:%.*]] = phi i32 [ [[STATE_1_BE_SI_UNFOLD_PHI_JT2]], [[STATE_1_BE2_SI_UNFOLD_FALSE_JT2:%.*]] ]
113 ; CHECK-NEXT: br label [[LOOP_2_JT2:%.*]]
115 ; CHECK-NEXT: [[STATE_1_JT1:%.*]] = phi i32 [ 1, [[LOOP_1_BACKEDGE]] ], [ 1, [[LOOP_1_BACKEDGE_JT2]] ], [ 1, [[LOOP_1_BACKEDGE_JT4]] ]
116 ; CHECK-NEXT: br label [[LOOP_2_JT1:%.*]]
118 ; CHECK-NEXT: [[STATE_2:%.*]] = phi i32 [ [[STATE_1]], [[LOOP_1]] ], [ poison, [[LOOP_2_BACKEDGE:%.*]] ]
119 ; CHECK-NEXT: br label [[LOOP_3:%.*]]
121 ; CHECK-NEXT: [[STATE_2_JT0:%.*]] = phi i32 [ [[STATE_2_BE_JT0:%.*]], [[LOOP_2_BACKEDGE_JT0:%.*]] ]
122 ; CHECK-NEXT: br label [[LOOP_3_JT0:%.*]]
124 ; CHECK-NEXT: [[STATE_2_JT3:%.*]] = phi i32 [ [[STATE_2_BE_JT3:%.*]], [[LOOP_2_BACKEDGE_JT3:%.*]] ]
125 ; CHECK-NEXT: br label [[LOOP_3_JT3:%.*]]
127 ; CHECK-NEXT: [[STATE_2_JT4:%.*]] = phi i32 [ [[STATE_1_JT4]], [[LOOP_1_JT4]] ]
128 ; CHECK-NEXT: br label [[LOOP_3_JT4:%.*]]
130 ; CHECK-NEXT: [[STATE_2_JT2:%.*]] = phi i32 [ [[STATE_1_JT2]], [[LOOP_1_JT2]] ]
131 ; CHECK-NEXT: br label [[LOOP_3_JT2:%.*]]
133 ; CHECK-NEXT: [[STATE_2_JT1:%.*]] = phi i32 [ [[STATE_1_JT1]], [[LOOP_1_JT1:%.*]] ]
134 ; CHECK-NEXT: br label [[LOOP_3_JT1:%.*]]
136 ; CHECK-NEXT: [[STATE:%.*]] = phi i32 [ [[STATE_2]], [[LOOP_2]] ]
137 ; CHECK-NEXT: switch i32 [[STATE]], label [[INFLOOP_I:%.*]] [
138 ; CHECK-NEXT: i32 2, label [[CASE2:%.*]]
139 ; CHECK-NEXT: i32 3, label [[CASE3:%.*]]
140 ; CHECK-NEXT: i32 4, label [[CASE4:%.*]]
141 ; CHECK-NEXT: i32 0, label [[CASE0:%.*]]
142 ; CHECK-NEXT: i32 1, label [[CASE1:%.*]]
145 ; CHECK-NEXT: [[STATE_JT0:%.*]] = phi i32 [ [[STATE_2_JT0]], [[LOOP_2_JT0:%.*]] ]
146 ; CHECK-NEXT: br label [[CASE0]]
148 ; CHECK-NEXT: [[STATE_JT3:%.*]] = phi i32 [ 3, [[CASE2]] ], [ [[STATE_2_JT3]], [[LOOP_2_JT3:%.*]] ]
149 ; CHECK-NEXT: br label [[CASE3]]
151 ; CHECK-NEXT: [[STATE_JT4:%.*]] = phi i32 [ [[STATE_2_JT4]], [[LOOP_2_JT4]] ]
152 ; CHECK-NEXT: br label [[CASE4]]
154 ; CHECK-NEXT: [[STATE_JT2:%.*]] = phi i32 [ [[STATE_2_JT2]], [[LOOP_2_JT2]] ]
155 ; CHECK-NEXT: br label [[CASE2]]
157 ; CHECK-NEXT: [[STATE_JT1:%.*]] = phi i32 [ [[STATE_2_JT1]], [[LOOP_2_JT1]] ]
158 ; CHECK-NEXT: br label [[CASE1]]
160 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_3_JT3]], label [[LOOP_1_BACKEDGE_JT4]]
162 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_2_BACKEDGE_JT0]], label [[CASE4]]
164 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_2_BACKEDGE_JT3]], label [[LOOP_1_BACKEDGE_JT2]]
165 ; CHECK: loop.1.backedge:
166 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_1_JT1]], label [[STATE_1_BE2_SI_UNFOLD_FALSE]]
167 ; CHECK: loop.1.backedge.jt4:
168 ; CHECK-NEXT: [[STATE_1_BE_JT4]] = phi i32 [ 4, [[CASE2]] ]
169 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_1_JT1]], label [[STATE_1_BE2_SI_UNFOLD_FALSE_JT4]]
170 ; CHECK: loop.1.backedge.jt2:
171 ; CHECK-NEXT: [[STATE_1_BE_JT2]] = phi i32 [ 2, [[CASE4]] ]
172 ; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_1_JT1]], label [[STATE_1_BE2_SI_UNFOLD_FALSE_JT2]]
173 ; CHECK: loop.2.backedge:
174 ; CHECK-NEXT: br label [[LOOP_2]]
175 ; CHECK: loop.2.backedge.jt0:
176 ; CHECK-NEXT: [[STATE_2_BE_JT0]] = phi i32 [ 0, [[CASE3]] ]
177 ; CHECK-NEXT: br label [[LOOP_2_JT0]]
178 ; CHECK: loop.2.backedge.jt3:
179 ; CHECK-NEXT: [[STATE_2_BE_JT3]] = phi i32 [ 3, [[CASE4]] ]
180 ; CHECK-NEXT: br label [[LOOP_2_JT3]]
182 ; CHECK-NEXT: br label [[EXIT:%.*]]
184 ; CHECK-NEXT: br label [[EXIT]]
186 ; CHECK-NEXT: br label [[INFLOOP_I]]
188 ; CHECK-NEXT: ret i32 0
191 %cmp = icmp eq i32 %init, 0
192 %sel = select i1 %cmp, i32 0, i32 2
196 %state.1 = phi i32 [ %sel, %entry ], [ %state.1.be2, %loop.1.backedge ]
200 %state.2 = phi i32 [ %state.1, %loop.1 ], [ %state.2.be, %loop.2.backedge ]
204 %state = phi i32 [ %state.2, %loop.2 ], [ 3, %case2 ]
205 switch i32 %state, label %infloop.i [
214 br i1 %cmp, label %loop.3, label %loop.1.backedge
217 br i1 %cmp, label %loop.2.backedge, label %case4
220 br i1 %cmp, label %loop.2.backedge, label %loop.1.backedge
223 %state.1.be = phi i32 [ 2, %case4 ], [ 4, %case2 ]
224 %state.1.be2 = select i1 %cmp, i32 1, i32 %state.1.be
228 %state.2.be = phi i32 [ 3, %case4 ], [ 0, %case3 ]
244 define void @pr78059_bitwidth() {
245 ; CHECK-LABEL: @pr78059_bitwidth(
246 ; CHECK-NEXT: .split.preheader:
247 ; CHECK-NEXT: br label [[DOTSPLIT:%.*]]
249 ; CHECK-NEXT: [[TMP0:%.*]] = phi i128 [ 0, [[DOTSPLIT_PREHEADER:%.*]] ]
250 ; CHECK-NEXT: switch i128 [[TMP0]], label [[END:%.*]] [
251 ; CHECK-NEXT: i128 -1, label [[END]]
252 ; CHECK-NEXT: i128 0, label [[DOTSPLIT_JT18446744073709551615:%.*]]
254 ; CHECK: .split.jt18446744073709551615:
255 ; CHECK-NEXT: [[TMP1:%.*]] = phi i128 [ -1, [[DOTSPLIT]] ]
256 ; CHECK-NEXT: br label [[END]]
258 ; CHECK-NEXT: ret void
264 %0 = phi i128 [ 0, %.split.preheader ], [ -1, %.split ]
265 switch i128 %0, label %end [
267 i128 0, label %.split
274 define void @self-reference() {
275 ; CHECK-LABEL: @self-reference(
276 ; CHECK-NEXT: .split.preheader:
277 ; CHECK-NEXT: br label [[DOTSPLIT:%.*]]
279 ; CHECK-NEXT: [[TMP0:%.*]] = phi i32 [ 0, [[DOTSPLIT_PREHEADER:%.*]] ]
280 ; CHECK-NEXT: switch i32 [[TMP0]], label [[END:%.*]] [
281 ; CHECK-NEXT: i32 -1, label [[END]]
282 ; CHECK-NEXT: i32 0, label [[DOTSPLIT_JT4294967295:%.*]]
284 ; CHECK: .split.jt4294967295:
285 ; CHECK-NEXT: [[TMP1:%.*]] = phi i32 [ -1, [[DOTSPLIT]] ]
286 ; CHECK-NEXT: br label [[END]]
288 ; CHECK-NEXT: ret void
294 %0 = phi i32 [ 0, %.split.preheader ], [ -1, %.split ]
295 switch i32 %0, label %end [
304 define void @pr106083_invalidBBarg_fold(i1 %cmp1, i1 %cmp2, i1 %not, ptr %d) {
305 ; CHECK-LABEL: @pr106083_invalidBBarg_fold(
307 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[BB1:%.*]], label [[SEL_SI_UNFOLD_FALSE:%.*]]
308 ; CHECK: sel.si.unfold.false:
309 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI1:%.*]] = phi i32 [ 1, [[BB:%.*]] ]
310 ; CHECK-NEXT: br label [[BB1]]
312 ; CHECK-NEXT: [[I:%.*]] = phi i16 [ 0, [[BB1_BACKEDGE:%.*]] ], [ 0, [[BB]] ], [ 1, [[BB7:%.*]] ], [ 0, [[SEL_SI_UNFOLD_FALSE]] ], [ 1, [[BB7_JT0:%.*]] ]
313 ; CHECK-NEXT: [[SEL_SI_UNFOLD_PHI:%.*]] = phi i32 [ [[SEL_SI_UNFOLD_PHI]], [[BB1_BACKEDGE]] ], [ [[SEL_SI_UNFOLD_PHI]], [[BB7]] ], [ 0, [[BB]] ], [ [[DOTSI_UNFOLD_PHI1]], [[SEL_SI_UNFOLD_FALSE]] ], [ [[SEL_SI_UNFOLD_PHI]], [[BB7_JT0]] ]
314 ; CHECK-NEXT: br i1 [[NOT:%.*]], label [[BB7_JT0]], label [[BB2:%.*]]
316 ; CHECK-NEXT: store i16 0, ptr [[D:%.*]], align 2
317 ; CHECK-NEXT: br i1 [[CMP2:%.*]], label [[BB7]], label [[SPEC_SELECT_SI_UNFOLD_FALSE_JT0:%.*]]
318 ; CHECK: spec.select.si.unfold.false:
319 ; CHECK-NEXT: br label [[BB7]]
320 ; CHECK: spec.select.si.unfold.false.jt0:
321 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI_JT0:%.*]] = phi i32 [ 0, [[BB2]] ]
322 ; CHECK-NEXT: br label [[BB7_JT0]]
324 ; CHECK-NEXT: [[D_PROMOTED4:%.*]] = phi i16 [ 1, [[BB2]] ], [ 1, [[SPEC_SELECT_SI_UNFOLD_FALSE:%.*]] ]
325 ; CHECK-NEXT: [[_3:%.*]] = phi i32 [ [[SEL_SI_UNFOLD_PHI]], [[BB2]] ], [ poison, [[SPEC_SELECT_SI_UNFOLD_FALSE]] ]
326 ; CHECK-NEXT: switch i32 [[_3]], label [[BB1_BACKEDGE]] [
327 ; CHECK-NEXT: i32 0, label [[BB1]]
328 ; CHECK-NEXT: i32 1, label [[BB8:%.*]]
331 ; CHECK-NEXT: [[D_PROMOTED4_JT0:%.*]] = phi i16 [ 0, [[BB1]] ], [ 1, [[SPEC_SELECT_SI_UNFOLD_FALSE_JT0]] ]
332 ; CHECK-NEXT: [[_3_JT0:%.*]] = phi i32 [ 0, [[BB1]] ], [ [[DOTSI_UNFOLD_PHI_JT0]], [[SPEC_SELECT_SI_UNFOLD_FALSE_JT0]] ]
333 ; CHECK-NEXT: br label [[BB1]]
334 ; CHECK: BB1.backedge:
335 ; CHECK-NEXT: br label [[BB1]]
337 ; CHECK-NEXT: ret void
340 %sel = select i1 %cmp1, i32 0, i32 1
343 BB1: ; preds = %BB1.backedge, %BB7, %bb
344 %i = phi i16 [ 0, %BB1.backedge ], [ 0, %bb ], [ 1, %BB7 ]
345 br i1 %not, label %BB7, label %BB2
348 store i16 0, ptr %d, align 2
349 %spec.select = select i1 %cmp2, i32 %sel, i32 0
352 BB7: ; preds = %BB2, %BB1
353 %d.promoted4 = phi i16 [ 0, %BB1 ], [ 1, %BB2 ]
354 %_3 = phi i32 [ 0, %BB1 ], [ %spec.select, %BB2 ]
355 switch i32 %_3, label %BB1.backedge [
360 BB1.backedge: ; preds = %BB7
367 define void @pr106083_select_dead_uses(i1 %cmp1, i1 %not, ptr %p) {
368 ; CHECK-LABEL: @pr106083_select_dead_uses(
370 ; CHECK-NEXT: br i1 [[CMP1:%.*]], label [[DOTLOOPEXIT6:%.*]], label [[SPEC_SELECT_SI_UNFOLD_FALSE:%.*]]
371 ; CHECK: spec.select.si.unfold.false:
372 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI1:%.*]] = phi i32 [ 1, [[BB:%.*]] ]
373 ; CHECK-NEXT: br label [[DOTLOOPEXIT6]]
375 ; CHECK-NEXT: [[SPEC_SELECT_SI_UNFOLD_PHI:%.*]] = phi i32 [ [[SPEC_SELECT_SI_UNFOLD_PHI]], [[SELECT_UNFOLD:%.*]] ], [ 0, [[BB]] ], [ [[DOTSI_UNFOLD_PHI1]], [[SPEC_SELECT_SI_UNFOLD_FALSE]] ]
376 ; CHECK-NEXT: br i1 [[NOT:%.*]], label [[SELECT_UNFOLD_JT0:%.*]], label [[BB1:%.*]]
378 ; CHECK-NEXT: [[I:%.*]] = load i32, ptr [[P:%.*]], align 4
379 ; CHECK-NEXT: [[NOT2:%.*]] = icmp eq i32 0, 0
380 ; CHECK-NEXT: br i1 [[NOT2]], label [[SELECT_UNFOLD]], label [[SPEC_SELECT7_SI_UNFOLD_FALSE_JT0:%.*]]
381 ; CHECK: spec.select7.si.unfold.false:
382 ; CHECK-NEXT: br label [[SELECT_UNFOLD]]
383 ; CHECK: spec.select7.si.unfold.false.jt0:
384 ; CHECK-NEXT: [[DOTSI_UNFOLD_PHI_JT0:%.*]] = phi i32 [ 0, [[BB1]] ]
385 ; CHECK-NEXT: br label [[SELECT_UNFOLD_JT0]]
386 ; CHECK: select.unfold:
387 ; CHECK-NEXT: [[_2:%.*]] = phi i32 [ [[SPEC_SELECT_SI_UNFOLD_PHI]], [[BB1]] ], [ poison, [[SPEC_SELECT7_SI_UNFOLD_FALSE:%.*]] ]
388 ; CHECK-NEXT: switch i32 [[_2]], label [[BB2:%.*]] [
389 ; CHECK-NEXT: i32 0, label [[DOTPREHEADER_PREHEADER:%.*]]
390 ; CHECK-NEXT: i32 1, label [[DOTLOOPEXIT6]]
392 ; CHECK: select.unfold.jt0:
393 ; CHECK-NEXT: [[_2_JT0:%.*]] = phi i32 [ 0, [[DOTLOOPEXIT6]] ], [ [[DOTSI_UNFOLD_PHI_JT0]], [[SPEC_SELECT7_SI_UNFOLD_FALSE_JT0]] ]
394 ; CHECK-NEXT: br label [[DOTPREHEADER_PREHEADER]]
395 ; CHECK: .preheader.preheader:
396 ; CHECK-NEXT: ret void
398 ; CHECK-NEXT: unreachable
401 %spec.select = select i1 %cmp1, i32 0, i32 1
404 .loopexit6: ; preds = %select.unfold, %bb
405 br i1 %not, label %select.unfold, label %bb1
407 bb1: ; preds = %.loopexit6
408 %i = load i32, ptr %p, align 4
409 %not2 = icmp eq i32 0, 0
410 %spec.select7 = select i1 %not2, i32 %spec.select, i32 0
411 br label %select.unfold
413 select.unfold: ; preds = %bb1, %.loopexit6
414 %_2 = phi i32 [ 0, %.loopexit6 ], [ %spec.select7, %bb1 ]
415 switch i32 %_2, label %bb2 [
416 i32 0, label %.preheader.preheader
417 i32 1, label %.loopexit6
420 .preheader.preheader: ; preds = %select.unfold
423 bb2: ; preds = %select.unfold