blob: cd9749bbf6d0f7174fb9c9eec87f2bad4997b878 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; 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
Dan Gohman3c7d3082009-09-11 18:01:28 +00005; RUN: opt < %s -loopsimplify
Tanya Lattner348c6182008-03-25 04:26:08 +00006define i32 @re_match_2() {
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007 br label %loopentry.1
Tanya Lattner348c6182008-03-25 04:26:08 +00008loopentry.1: ; preds = %endif.82, %0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009 br label %shortcirc_done.36
Tanya Lattner348c6182008-03-25 04:26:08 +000010shortcirc_done.36: ; preds = %loopentry.1
11 br i1 false, label %fail, label %endif.40
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012endif.40: ; preds = %shortcirc_done.36
13 br label %loopexit.20
Tanya Lattner348c6182008-03-25 04:26:08 +000014loopentry.20: ; preds = %endif.46
Dan Gohmanf17a25c2007-07-18 16:29:46 +000015 br label %loopexit.20
Tanya Lattner348c6182008-03-25 04:26:08 +000016loopexit.20: ; preds = %loopentry.20, %endif.40
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017 br label %loopentry.21
Tanya Lattner348c6182008-03-25 04:26:08 +000018loopentry.21: ; preds = %no_exit.19, %loopexit.20
19 br i1 false, label %no_exit.19, label %loopexit.21
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020no_exit.19: ; preds = %loopentry.21
Tanya Lattner348c6182008-03-25 04:26:08 +000021 br i1 false, label %fail, label %loopentry.21
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022loopexit.21: ; preds = %loopentry.21
23 br label %endif.45
Dan Gohmanf17a25c2007-07-18 16:29:46 +000024endif.45: ; preds = %loopexit.21
25 br label %cond_true.15
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026cond_true.15: ; preds = %endif.45
Tanya Lattner348c6182008-03-25 04:26:08 +000027 br i1 false, label %fail, label %endif.46
Dan Gohmanf17a25c2007-07-18 16:29:46 +000028endif.46: ; preds = %cond_true.15
29 br label %loopentry.20
Tanya Lattner348c6182008-03-25 04:26:08 +000030fail: ; preds = %loopexit.37, %cond_true.15, %no_exit.19, %shortcirc_done.36
Dan Gohmanf17a25c2007-07-18 16:29:46 +000031 br label %then.80
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032then.80: ; preds = %fail
33 br label %endif.81
Dan Gohmanf17a25c2007-07-18 16:29:46 +000034endif.81: ; preds = %then.80
35 br label %loopexit.37
Dan Gohmanf17a25c2007-07-18 16:29:46 +000036loopexit.37: ; preds = %endif.81
Tanya Lattner348c6182008-03-25 04:26:08 +000037 br i1 false, label %fail, label %endif.82
Dan Gohmanf17a25c2007-07-18 16:29:46 +000038endif.82: ; preds = %loopexit.37
39 br label %loopentry.1
40}
Tanya Lattner348c6182008-03-25 04:26:08 +000041
42