25 lines · plain
1; RUN: opt < %s -loop-reduce -S | grep phi | count 12 3; This testcase should have ONE stride 18 indvar, the other use should have a4; loop invariant value (B) added to it inside of the loop, instead of having5; a whole indvar based on B for it.6 7declare i1 @cond(i32)8 9define void @test(i32 %B) {10; <label>:011 br label %Loop12Loop: ; preds = %Loop, %013 %IV = phi i32 [ 0, %0 ], [ %IVn, %Loop ] ; <i32> [#uses=3]14 %C = mul i32 %IV, 18 ; <i32> [#uses=1]15 %D = mul i32 %IV, 18 ; <i32> [#uses=1]16 %E = add i32 %D, %B ; <i32> [#uses=1]17 %cnd = call i1 @cond( i32 %E ) ; <i1> [#uses=1]18 call i1 @cond( i32 %C ) ; <i1>:1 [#uses=0]19 %IVn = add i32 %IV, 1 ; <i32> [#uses=1]20 br i1 %cnd, label %Loop, label %Out21Out: ; preds = %Loop22 ret void23}24 25