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