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.
4
5; RUN: opt < %s -loop-simplify
6define i32 @re_match_2() {
7	br label %loopentry.1
8loopentry.1:		; preds = %endif.82, %0
9	br label %shortcirc_done.36
10shortcirc_done.36:		; preds = %loopentry.1
11	br i1 false, label %fail, label %endif.40
12endif.40:		; preds = %shortcirc_done.36
13	br label %loopexit.20
14loopentry.20:		; preds = %endif.46
15	br label %loopexit.20
16loopexit.20:		; preds = %loopentry.20, %endif.40
17	br label %loopentry.21
18loopentry.21:		; preds = %no_exit.19, %loopexit.20
19	br i1 false, label %no_exit.19, label %loopexit.21
20no_exit.19:		; preds = %loopentry.21
21	br i1 false, label %fail, label %loopentry.21
22loopexit.21:		; preds = %loopentry.21
23	br label %endif.45
24endif.45:		; preds = %loopexit.21
25	br label %cond_true.15
26cond_true.15:		; preds = %endif.45
27	br i1 false, label %fail, label %endif.46
28endif.46:		; preds = %cond_true.15
29	br label %loopentry.20
30fail:		; preds = %loopexit.37, %cond_true.15, %no_exit.19, %shortcirc_done.36
31	br label %then.80
32then.80:		; preds = %fail
33	br label %endif.81
34endif.81:		; preds = %then.80
35	br label %loopexit.37
36loopexit.37:		; preds = %endif.81
37	br i1 false, label %fail, label %endif.82
38endif.82:		; preds = %loopexit.37
39	br label %loopentry.1
40}
41
42
43