1 ; This (complex) testcase causes an assertion failure because a preheader is
2 ; inserted for the "fail" loop, but the exit block of a loop is not updated
3 ; to be the preheader instead of the exit loop itself.
5 ; RUN: opt < %s -passes=loop-simplify
6 define i32 @re_match_2() {
8 loopentry.1: ; preds = %endif.82, %0
9 br label %shortcirc_done.36
10 shortcirc_done.36: ; preds = %loopentry.1
11 br i1 false, label %fail, label %endif.40
12 endif.40: ; preds = %shortcirc_done.36
14 loopentry.20: ; preds = %endif.46
16 loopexit.20: ; preds = %loopentry.20, %endif.40
17 br label %loopentry.21
18 loopentry.21: ; preds = %no_exit.19, %loopexit.20
19 br i1 false, label %no_exit.19, label %loopexit.21
20 no_exit.19: ; preds = %loopentry.21
21 br i1 false, label %fail, label %loopentry.21
22 loopexit.21: ; preds = %loopentry.21
24 endif.45: ; preds = %loopexit.21
25 br label %cond_true.15
26 cond_true.15: ; preds = %endif.45
27 br i1 false, label %fail, label %endif.46
28 endif.46: ; preds = %cond_true.15
29 br label %loopentry.20
30 fail: ; preds = %loopexit.37, %cond_true.15, %no_exit.19, %shortcirc_done.36
32 then.80: ; preds = %fail
34 endif.81: ; preds = %then.80
36 loopexit.37: ; preds = %endif.81
37 br i1 false, label %fail, label %endif.82
38 endif.82: ; preds = %loopexit.37