• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -loop-simplify -lcssa -verify-loop-info -verify-dom-info -S | FileCheck %s
2
3; LCSSA should work correctly in the case of an indirectbr that exits
4; the loop, and the loop has exits with predecessors not within the loop
5; (and btw these edges are unsplittable due to the indirectbr).
6; PR5437
7define i32 @test0() nounwind {
8; CHECK-LABEL: @test0
9entry:
10  br i1 undef, label %"4", label %"3"
11
12"3":                                              ; preds = %entry
13  ret i32 0
14
15"4":                                              ; preds = %entry
16  br i1 undef, label %"6", label %"5"
17
18"5":                                              ; preds = %"4"
19  unreachable
20
21"6":                                              ; preds = %"4"
22  br i1 undef, label %"10", label %"13"
23
24"10":                                             ; preds = %"6"
25  br i1 undef, label %"22", label %"15"
26
27"13":                                             ; preds = %"6"
28  unreachable
29
30"15":                                             ; preds = %"23", %"10"
31  unreachable
32
33"22":                                             ; preds = %"10"
34  br label %"23"
35
36"23":                                             ; preds = %"1375", %"22"
37  %0 = phi i32 [ undef, %"22" ], [ %1, %"1375" ]  ; <i32> [#uses=1]
38  indirectbr i8* undef, [label %"15", label %"24", label %"25", label %"26", label %"27", label %"28", label %"29", label %"30", label %"32", label %"32", label %"33", label %"167", label %"173", label %"173", label %"173", label %"173", label %"173", label %"192", label %"193", label %"194", label %"196", label %"206", label %"231", label %"241", label %"251", label %"261", label %"307", label %"353", label %"354", label %"355", label %"361", label %"367", label %"400", label %"433", label %"466", label %"499", label %"509", label %"519", label %"529", label %"571", label %"589", label %"607", label %"635", label %"655", label %"664", label %"671", label %"680", label %"687", label %"692", label %"698", label %"704", label %"715", label %"715", label %"716", label %"725", label %"725", label %"725", label %"725", label %"724", label %"724", label %"724", label %"724", label %"737", label %"737", label %"737", label %"737", label %"761", label %"758", label %"759", label %"760", label %"766", label %"763", label %"764", label %"765", label %"771", label %"768", label %"769", label %"770", label %"780", label %"777", label %"778", label %"779", label %"821", label %"826", label %"831", label %"832", label %"833", label %"836", label %"836", label %"886", label %"905", label %"978", label %"978", label %"1136", label %"1166", label %"1179", label %"1201", label %"1212", label %"1212", label %"1274", label %"1284", label %"1284", label %"1346", label %"1347", label %"1348", label %"1349", label %"1350", label %"1353", label %"1353", label %"1353", label %"1355", label %"1355", label %"1357", label %"1357", label %"1358", label %"1359", label %"1374", label %"1375", label %"1376", label %"1377", label %"1378", label %"1379", label %"1386", label %"1395", label %"1394", label %"1425", label %"1426", label %"1440", label %"1449", label %"1455", label %"1461", label %"1471", label %"1482", label %"1484", label %"1486", label %"1489", label %"1489", label %"1492", label %"1494", label %"1494", label %"1497", label %"1499", label %"1499", label %"1515", label %"1546", label %"1546", label %"1566", label %"1584", label %"1587", label %"1591", label %"1605", label %"1609", label %"1609", label %"1640", label %"1648", label %"1651", label %"1703", label %"1710", label %"1718", label %"1724", label %"1725", label %"1726", label %"1727", label %"1728", label %"1731", label %"1732", label %"1733", label %"1734", label %"1735", label %"1741", label %"1750", label %"1752", label %"1754", label %"1755", label %"1757", label %"1759", label %"1761", label %"1764", label %"1764", label %"1766", label %"1768", label %"1775", label %"1775", label %"1781", label %"1781", label %"1790", label %"1827", label %"1836", label %"1836", label %"1845", label %"1845", label %"1848", label %"1849", label %"1851", label %"1853", label %"1856", label %"1861", label %"1861"]
39
40"24":                                             ; preds = %"23"
41  unreachable
42
43"25":                                             ; preds = %"23"
44  unreachable
45
46"26":                                             ; preds = %"23"
47  unreachable
48
49"27":                                             ; preds = %"23"
50  unreachable
51
52"28":                                             ; preds = %"23"
53  unreachable
54
55"29":                                             ; preds = %"23"
56  unreachable
57
58"30":                                             ; preds = %"23"
59  unreachable
60
61"32":                                             ; preds = %"23", %"23"
62  unreachable
63
64"33":                                             ; preds = %"23"
65  unreachable
66
67"167":                                            ; preds = %"23"
68  unreachable
69
70"173":                                            ; preds = %"23", %"23", %"23", %"23", %"23"
71  unreachable
72
73"192":                                            ; preds = %"23"
74  unreachable
75
76"193":                                            ; preds = %"23"
77  unreachable
78
79"194":                                            ; preds = %"23"
80  unreachable
81
82"196":                                            ; preds = %"23"
83  unreachable
84
85"206":                                            ; preds = %"23"
86  unreachable
87
88"231":                                            ; preds = %"23"
89  unreachable
90
91"241":                                            ; preds = %"23"
92  unreachable
93
94"251":                                            ; preds = %"23"
95  unreachable
96
97"261":                                            ; preds = %"23"
98  unreachable
99
100"307":                                            ; preds = %"23"
101  unreachable
102
103"353":                                            ; preds = %"23"
104  unreachable
105
106"354":                                            ; preds = %"23"
107  unreachable
108
109"355":                                            ; preds = %"23"
110  unreachable
111
112"361":                                            ; preds = %"23"
113  unreachable
114
115"367":                                            ; preds = %"23"
116  unreachable
117
118"400":                                            ; preds = %"23"
119  unreachable
120
121"433":                                            ; preds = %"23"
122  unreachable
123
124"466":                                            ; preds = %"23"
125  unreachable
126
127"499":                                            ; preds = %"23"
128  unreachable
129
130"509":                                            ; preds = %"23"
131  unreachable
132
133"519":                                            ; preds = %"23"
134  unreachable
135
136"529":                                            ; preds = %"23"
137  unreachable
138
139"571":                                            ; preds = %"23"
140  unreachable
141
142"589":                                            ; preds = %"23"
143  unreachable
144
145"607":                                            ; preds = %"23"
146  unreachable
147
148"635":                                            ; preds = %"23"
149  unreachable
150
151"655":                                            ; preds = %"23"
152  unreachable
153
154"664":                                            ; preds = %"23"
155  unreachable
156
157"671":                                            ; preds = %"23"
158  unreachable
159
160"680":                                            ; preds = %"23"
161  unreachable
162
163"687":                                            ; preds = %"23"
164  unreachable
165
166"692":                                            ; preds = %"23"
167  br label %"1862"
168
169"698":                                            ; preds = %"23"
170  unreachable
171
172"704":                                            ; preds = %"23"
173  unreachable
174
175"715":                                            ; preds = %"23", %"23"
176  unreachable
177
178"716":                                            ; preds = %"23"
179  unreachable
180
181"724":                                            ; preds = %"23", %"23", %"23", %"23"
182  unreachable
183
184"725":                                            ; preds = %"23", %"23", %"23", %"23"
185  unreachable
186
187"737":                                            ; preds = %"23", %"23", %"23", %"23"
188  unreachable
189
190"758":                                            ; preds = %"23"
191  unreachable
192
193"759":                                            ; preds = %"23"
194  unreachable
195
196"760":                                            ; preds = %"23"
197  unreachable
198
199"761":                                            ; preds = %"23"
200  unreachable
201
202"763":                                            ; preds = %"23"
203  unreachable
204
205"764":                                            ; preds = %"23"
206  unreachable
207
208"765":                                            ; preds = %"23"
209  br label %"766"
210
211"766":                                            ; preds = %"765", %"23"
212  unreachable
213
214"768":                                            ; preds = %"23"
215  unreachable
216
217"769":                                            ; preds = %"23"
218  unreachable
219
220"770":                                            ; preds = %"23"
221  unreachable
222
223"771":                                            ; preds = %"23"
224  unreachable
225
226"777":                                            ; preds = %"23"
227  unreachable
228
229"778":                                            ; preds = %"23"
230  unreachable
231
232"779":                                            ; preds = %"23"
233  unreachable
234
235"780":                                            ; preds = %"23"
236  unreachable
237
238"821":                                            ; preds = %"23"
239  unreachable
240
241"826":                                            ; preds = %"23"
242  unreachable
243
244"831":                                            ; preds = %"23"
245  unreachable
246
247"832":                                            ; preds = %"23"
248  unreachable
249
250"833":                                            ; preds = %"23"
251  unreachable
252
253"836":                                            ; preds = %"23", %"23"
254  unreachable
255
256"886":                                            ; preds = %"23"
257  unreachable
258
259"905":                                            ; preds = %"23"
260  unreachable
261
262"978":                                            ; preds = %"23", %"23"
263  unreachable
264
265"1136":                                           ; preds = %"23"
266  unreachable
267
268"1166":                                           ; preds = %"23"
269  unreachable
270
271"1179":                                           ; preds = %"23"
272  unreachable
273
274"1201":                                           ; preds = %"23"
275  unreachable
276
277"1212":                                           ; preds = %"23", %"23"
278  unreachable
279
280"1274":                                           ; preds = %"23"
281  unreachable
282
283"1284":                                           ; preds = %"23", %"23"
284  unreachable
285
286"1346":                                           ; preds = %"23"
287  unreachable
288
289"1347":                                           ; preds = %"23"
290  unreachable
291
292"1348":                                           ; preds = %"23"
293  unreachable
294
295"1349":                                           ; preds = %"23"
296  unreachable
297
298"1350":                                           ; preds = %"23"
299  unreachable
300
301"1353":                                           ; preds = %"23", %"23", %"23"
302  unreachable
303
304"1355":                                           ; preds = %"23", %"23"
305  unreachable
306
307"1357":                                           ; preds = %"23", %"23"
308  unreachable
309
310"1358":                                           ; preds = %"23"
311  unreachable
312
313"1359":                                           ; preds = %"23"
314  unreachable
315
316"1374":                                           ; preds = %"23"
317  unreachable
318
319"1375":                                           ; preds = %"23"
320  %1 = zext i8 undef to i32                       ; <i32> [#uses=1]
321  br label %"23"
322
323"1376":                                           ; preds = %"23"
324  unreachable
325
326"1377":                                           ; preds = %"23"
327  unreachable
328
329"1378":                                           ; preds = %"23"
330  unreachable
331
332"1379":                                           ; preds = %"23"
333  unreachable
334
335"1386":                                           ; preds = %"23"
336  unreachable
337
338"1394":                                           ; preds = %"23"
339  unreachable
340
341"1395":                                           ; preds = %"23"
342  unreachable
343
344"1425":                                           ; preds = %"23"
345  unreachable
346
347"1426":                                           ; preds = %"23"
348  unreachable
349
350"1440":                                           ; preds = %"23"
351  unreachable
352
353"1449":                                           ; preds = %"23"
354  unreachable
355
356"1455":                                           ; preds = %"23"
357  unreachable
358
359"1461":                                           ; preds = %"23"
360  unreachable
361
362"1471":                                           ; preds = %"23"
363  unreachable
364
365"1482":                                           ; preds = %"23"
366  unreachable
367
368"1484":                                           ; preds = %"23"
369  unreachable
370
371"1486":                                           ; preds = %"23"
372  unreachable
373
374"1489":                                           ; preds = %"23", %"23"
375  unreachable
376
377"1492":                                           ; preds = %"23"
378  unreachable
379
380"1494":                                           ; preds = %"23", %"23"
381  unreachable
382
383"1497":                                           ; preds = %"23"
384  unreachable
385
386"1499":                                           ; preds = %"23", %"23"
387  unreachable
388
389"1515":                                           ; preds = %"23"
390  unreachable
391
392"1546":                                           ; preds = %"23", %"23"
393  unreachable
394
395"1566":                                           ; preds = %"23"
396  br i1 undef, label %"1569", label %"1568"
397
398"1568":                                           ; preds = %"1566"
399  unreachable
400
401"1569":                                           ; preds = %"1566"
402  unreachable
403
404"1584":                                           ; preds = %"23"
405  unreachable
406
407"1587":                                           ; preds = %"23"
408  unreachable
409
410"1591":                                           ; preds = %"23"
411  unreachable
412
413"1605":                                           ; preds = %"23"
414  unreachable
415
416"1609":                                           ; preds = %"23", %"23"
417  unreachable
418
419"1640":                                           ; preds = %"23"
420  unreachable
421
422"1648":                                           ; preds = %"23"
423  unreachable
424
425"1651":                                           ; preds = %"23"
426  unreachable
427
428"1703":                                           ; preds = %"23"
429  unreachable
430
431"1710":                                           ; preds = %"23"
432  unreachable
433
434"1718":                                           ; preds = %"23"
435  unreachable
436
437"1724":                                           ; preds = %"23"
438  unreachable
439
440"1725":                                           ; preds = %"23"
441  unreachable
442
443"1726":                                           ; preds = %"23"
444  unreachable
445
446"1727":                                           ; preds = %"23"
447  unreachable
448
449"1728":                                           ; preds = %"23"
450  unreachable
451
452"1731":                                           ; preds = %"23"
453  unreachable
454
455"1732":                                           ; preds = %"23"
456  unreachable
457
458"1733":                                           ; preds = %"23"
459  unreachable
460
461"1734":                                           ; preds = %"23"
462  unreachable
463
464"1735":                                           ; preds = %"23"
465  unreachable
466
467"1741":                                           ; preds = %"23"
468  unreachable
469
470"1750":                                           ; preds = %"23"
471  unreachable
472
473"1752":                                           ; preds = %"23"
474  unreachable
475
476"1754":                                           ; preds = %"23"
477  unreachable
478
479"1755":                                           ; preds = %"23"
480  unreachable
481
482"1757":                                           ; preds = %"23"
483  unreachable
484
485"1759":                                           ; preds = %"23"
486  unreachable
487
488"1761":                                           ; preds = %"23"
489  unreachable
490
491"1764":                                           ; preds = %"23", %"23"
492  %2 = icmp eq i32 %0, 168                        ; <i1> [#uses=0]
493  unreachable
494
495"1766":                                           ; preds = %"23"
496  unreachable
497
498"1768":                                           ; preds = %"23"
499  unreachable
500
501"1775":                                           ; preds = %"23", %"23"
502  unreachable
503
504"1781":                                           ; preds = %"23", %"23"
505  unreachable
506
507"1790":                                           ; preds = %"23"
508  unreachable
509
510"1827":                                           ; preds = %"23"
511  unreachable
512
513"1836":                                           ; preds = %"23", %"23"
514  br label %"1862"
515
516"1845":                                           ; preds = %"23", %"23"
517  unreachable
518
519"1848":                                           ; preds = %"23"
520  unreachable
521
522"1849":                                           ; preds = %"23"
523  unreachable
524
525"1851":                                           ; preds = %"23"
526  unreachable
527
528"1853":                                           ; preds = %"23"
529  unreachable
530
531"1856":                                           ; preds = %"23"
532  unreachable
533
534"1861":                                           ; preds = %"23", %"23"
535  unreachable
536
537"41":                                             ; preds = %"23", %"23"
538  unreachable
539
540"1862":                                           ; preds = %"1836", %"692"
541  unreachable
542}
543
544; An exit for Loop L1 may be the header of a disjoint Loop L2.  Thus, when we
545; create PHIs in one of such exits we are also inserting PHIs in L2 header. This
546; could break LCSSA form for L2 because these inserted PHIs can also have uses
547; in L2 exits. Test that we don't assert/crash on that.
548define void @test1() {
549; CHECK-LABEL: @test1
550  br label %lab1
551
552lab1:
553  %tmp21 = add i32 undef, 677038203
554  br i1 undef, label %lab2, label %exit
555
556lab2:
557  indirectbr i8* undef, [label %lab1, label %lab3]
558
559lab3:
560; CHECK: %tmp21.lcssa1 = phi i32 [ %tmp21.lcssa1, %lab4 ], [ %tmp21, %lab2 ]
561  %tmp12 = phi i32 [ %tmp21, %lab2 ], [ %tmp12, %lab4 ]
562  br i1 undef, label %lab5, label %lab4
563
564lab4:
565  br label %lab3
566
567lab5:
568; CHECK:  %tmp21.lcssa1.lcssa = phi i32 [ %tmp21.lcssa1, %lab3 ]
569  %tmp15 = add i32 %tmp12, undef
570  br label %exit
571
572exit:
573  ret void
574}
575