blob: c2dee6a72ed6fcf25ebd810bbc177c13c624a7db [file] [log] [blame]
Dan Gohman5bb7c7c2009-09-08 22:34:10 +00001; RUN: opt %s -indvars -S | grep indvar
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00002@G = global i32* null ; <i32**> [#uses=1]
3@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00005define void @test() {
6; <label>:0
7 br label %Loop
Dan Gohmanf17a25c2007-07-18 16:29:46 +00008
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00009Loop: ; preds = %Loop, %0
10 %X = phi i32* [ getelementptr ([40 x i32]* @Array, i64 0, i64 0), %0 ], [ %X.next, %Loop ] ; <i32*> [#uses=2]
11 %X.next = getelementptr i32* %X, i64 1 ; <i32*> [#uses=1]
12 store i32* %X, i32** @G
13 br label %Loop
Dan Gohmanf17a25c2007-07-18 16:29:46 +000014}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000015