2003-10-12 22:26:42 +00:00
|
|
|
; The loop canonicalization pass should guarantee that there is one backedge
|
|
|
|
; for all loops. This allows the -indvars pass to recognize the %IV
|
|
|
|
; induction variable in this testcase.
|
|
|
|
|
2009-09-11 18:01:28 +00:00
|
|
|
; RUN: opt < %s -indvars -S | grep indvar
|
2003-10-12 22:26:42 +00:00
|
|
|
|
2008-03-25 04:26:08 +00:00
|
|
|
define i32 @test(i1 %C) {
|
|
|
|
; <label>:0
|
2003-10-12 22:26:42 +00:00
|
|
|
br label %Loop
|
2008-03-25 04:26:08 +00:00
|
|
|
Loop: ; preds = %BE2, %BE1, %0
|
2009-04-28 22:05:13 +00:00
|
|
|
%IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2]
|
|
|
|
store i32 %IV, i32* null
|
2008-03-25 04:26:08 +00:00
|
|
|
%IV2 = add i32 %IV, 2 ; <i32> [#uses=2]
|
|
|
|
br i1 %C, label %BE1, label %BE2
|
|
|
|
BE1: ; preds = %Loop
|
2003-10-12 22:26:42 +00:00
|
|
|
br label %Loop
|
2008-03-25 04:26:08 +00:00
|
|
|
BE2: ; preds = %Loop
|
2003-10-12 22:26:42 +00:00
|
|
|
br label %Loop
|
|
|
|
}
|
2008-03-25 04:26:08 +00:00
|
|
|
|