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.
|
|
|
|
|
2008-03-25 04:26:08 +00:00
|
|
|
; RUN: llvm-as < %s | opt -indvars | llvm-dis | 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
|
|
|
|
%IV = phi i32 [ 1, %0 ], [ %IV2, %BE1 ], [ %IV2, %BE2 ] ; <i32> [#uses=1]
|
|
|
|
%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
|
|
|
|