blob: f9567f124291ebeea035427ec6f3997571bc6623 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; The loop canonicalization pass should guarantee that there is one backedge
2; for all loops. This allows the -indvars pass to recognize the %IV
3; induction variable in this testcase.
4
Dan Gohman3c7d3082009-09-11 18:01:28 +00005; RUN: opt < %s -indvars -S | grep indvar
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Tanya Lattner348c6182008-03-25 04:26:08 +00007define i32 @test(i1 %C) {
8; <label>:0
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009 br label %Loop
Tanya Lattner348c6182008-03-25 04:26:08 +000010Loop: ; preds = %BE2, %BE1, %0
Dan Gohman5983efa2009-04-28 22:05:13 +000011 %IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2]
12 store i32 %IV, i32* null
Tanya Lattner348c6182008-03-25 04:26:08 +000013 %IV2 = add i32 %IV, 2 ; <i32> [#uses=2]
14 br i1 %C, label %BE1, label %BE2
15BE1: ; preds = %Loop
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016 br label %Loop
Tanya Lattner348c6182008-03-25 04:26:08 +000017BE2: ; preds = %Loop
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018 br label %Loop
19}
Tanya Lattner348c6182008-03-25 04:26:08 +000020