1 ; Check that this test makes INDVAR and related stuff dead. 2 ; RUN: opt < %s -loop-reduce -S | FileCheck %s 3 4 ; CHECK: phi 5 ; CHECK: phi 6 ; CHECK-NOT: phi 7 8 declare i1 @pred() 9 10 define void @test1({ i32, i32 }* %P) { 11 ; <label>:0 12 br label %Loop 13 Loop: ; preds = %Loop, %0 14 %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3] 15 %gep1 = getelementptr { i32, i32 }, { i32, i32 }* %P, i32 %INDVAR, i32 0 ; <i32*> [#uses=1] 16 store i32 0, i32* %gep1 17 %gep2 = getelementptr { i32, i32 }, { i32, i32 }* %P, i32 %INDVAR, i32 1 ; <i32*> [#uses=1] 18 store i32 0, i32* %gep2 19 %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] 20 %cond = call i1 @pred( ) ; <i1> [#uses=1] 21 br i1 %cond, label %Loop, label %Out 22 Out: ; preds = %Loop 23 ret void 24 } 25 26 define void @test2([2 x i32]* %P) { 27 ; <label>:0 28 br label %Loop 29 Loop: ; preds = %Loop, %0 30 %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=3] 31 %gep1 = getelementptr [2 x i32], [2 x i32]* %P, i32 %INDVAR, i64 0 ; <i32*> [#uses=1] 32 store i32 0, i32* %gep1 33 %gep2 = getelementptr [2 x i32], [2 x i32]* %P, i32 %INDVAR, i64 1 ; <i32*> [#uses=1] 34 store i32 0, i32* %gep2 35 %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1] 36 %cond = call i1 @pred( ) ; <i1> [#uses=1] 37 br i1 %cond, label %Loop, label %Out 38 Out: ; preds = %Loop 39 ret void 40 } 41