2003-10-13 06:26:42 +08: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-12 02:01:28 +08:00
|
|
|
; RUN: opt < %s -indvars -S | grep indvar
|
2003-10-13 06:26:42 +08:00
|
|
|
|
2008-03-25 12:26:08 +08:00
|
|
|
define i32 @test(i1 %C) {
|
|
|
|
; <label>:0
|
2003-10-13 06:26:42 +08:00
|
|
|
br label %Loop
|
2008-03-25 12:26:08 +08:00
|
|
|
Loop: ; preds = %BE2, %BE1, %0
|
2009-04-29 06:05:13 +08:00
|
|
|
%IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=2]
|
|
|
|
store i32 %IV, i32* null
|
2008-03-25 12:26:08 +08:00
|
|
|
%IV2 = add i32 %IV, 2 ; <i32> [#uses=2]
|
|
|
|
br i1 %C, label %BE1, label %BE2
|
|
|
|
BE1: ; preds = %Loop
|
2003-10-13 06:26:42 +08:00
|
|
|
br label %Loop
|
2008-03-25 12:26:08 +08:00
|
|
|
BE2: ; preds = %Loop
|
2003-10-13 06:26:42 +08:00
|
|
|
br label %Loop
|
|
|
|
}
|
2008-03-25 12:26:08 +08:00
|
|
|
|