blob: bb395324d4e4bff376c2857391a16da29baa8663 [file] [log] [blame]
Chris Lattner9cd727c2005-03-06 21:47:40 +00001; Check that this test makes INDVAR and related stuff dead.
Dan Gohman18800922009-09-11 18:01:28 +00002; RUN: opt < %s -loop-reduce -S | not grep INDVAR
Chris Lattner9cd727c2005-03-06 21:47:40 +00003
Tanya Lattnerab7872c2008-03-19 07:28:33 +00004declare i1 @pred()
Chris Lattner9cd727c2005-03-06 21:47:40 +00005
Tanya Lattnerab7872c2008-03-19 07:28:33 +00006define void @test(i32* %P) {
7; <label>:0
Chris Lattner9cd727c2005-03-06 21:47:40 +00008 br label %Loop
Tanya Lattnerab7872c2008-03-19 07:28:33 +00009Loop: ; preds = %Loop, %0
Dan Gohman45774ce2010-02-12 10:34:29 +000010 %i = phi i32 [ 0, %0 ], [ %i.next, %Loop ]
Tanya Lattnerab7872c2008-03-19 07:28:33 +000011 %INDVAR = phi i32 [ 0, %0 ], [ %INDVAR2, %Loop ] ; <i32> [#uses=2]
12 %STRRED = getelementptr i32* %P, i32 %INDVAR ; <i32*> [#uses=1]
13 store i32 0, i32* %STRRED
14 %INDVAR2 = add i32 %INDVAR, 1 ; <i32> [#uses=1]
Dan Gohman45774ce2010-02-12 10:34:29 +000015 %i.next = add i32 %i, 1
Tanya Lattnerab7872c2008-03-19 07:28:33 +000016 %cond = call i1 @pred( ) ; <i1> [#uses=1]
17 br i1 %cond, label %Loop, label %Out
18Out: ; preds = %Loop
Chris Lattner9cd727c2005-03-06 21:47:40 +000019 ret void
20}
Tanya Lattnerab7872c2008-03-19 07:28:33 +000021