blob: 1a5e64ddc1b9d0f31724725430c31b451178cff0 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -indvars -S > %t
Dan Gohmanebac2542009-02-23 23:20:35 +00002; RUN: not grep sext %t
Dan Gohmana5d38012009-02-18 17:22:41 +00003; RUN: grep phi %t | count 1
Dan Gohmana5d38012009-02-18 17:22:41 +00004
5define void @foo(i64* nocapture %x, i32 %n) nounwind {
6entry:
7 %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
8 br i1 %tmp102, label %bb.nph, label %return
9
10bb.nph: ; preds = %entry
11 br label %bb
12
13bb: ; preds = %bb7, %bb.nph
14 %i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
15 %tmp1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
16 %tmp4 = getelementptr i64* %x, i32 %i.01 ; <i64*> [#uses=1]
17 store i64 %tmp1, i64* %tmp4, align 8
18 %tmp6 = add i32 %i.01, 1 ; <i32> [#uses=2]
19 br label %bb7
20
21bb7: ; preds = %bb
22 %tmp10 = icmp slt i32 %tmp6, %n ; <i1> [#uses=1]
23 br i1 %tmp10, label %bb, label %bb7.return_crit_edge
24
25bb7.return_crit_edge: ; preds = %bb7
26 br label %return
27
28return: ; preds = %bb7.return_crit_edge, %entry
29 ret void
30}