Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
[oota-llvm.git] / test / Transforms / LoopIndexSplit / OneIterLoop2-2007-08-17.ll
1 ; Loop is elimianted. Save last value assignment.
2 ; RUN: opt < %s -loop-index-split -disable-output -stats |& \
3 ; RUN: grep "loop-index-split" | count 1
4
5         %struct.anon = type { i32 }
6 @S1 = external global i32               ; <i32*> [#uses=1]
7 @W1 = external global i32               ; <i32*> [#uses=1]
8 @Y = weak global [100 x %struct.anon] zeroinitializer, align 32         ; <[100 x %struct.anon]*> [#uses=1]
9 @ti = external global i32               ; <i32*> [#uses=1]
10 @T2 = external global [100 x [100 x i32]]               ; <[100 x [100 x i32]]*> [#uses=1]
11 @d = external global i32                ; <i32*> [#uses=1]
12 @T1 = external global i32               ; <i32*> [#uses=2]
13 @N1 = external global i32               ; <i32*> [#uses=2]
14
15 define void @foo() {
16 entry:
17         %tmp = load i32* @S1, align 4           ; <i32> [#uses=4]
18         %tmp266 = load i32* @N1, align 4                ; <i32> [#uses=1]
19         %tmp288 = icmp ult i32 %tmp, %tmp266            ; <i1> [#uses=1]
20         br i1 %tmp288, label %bb.preheader, label %return
21
22 bb.preheader:           ; preds = %entry
23         %tmp1 = load i32* @W1, align 4          ; <i32> [#uses=1]
24         %tmp13 = load i32* @ti, align 4         ; <i32> [#uses=1]
25         %tmp18 = load i32* @d, align 4          ; <i32> [#uses=1]
26         %tmp26 = load i32* @N1, align 4         ; <i32> [#uses=2]
27         %T1.promoted = load i32* @T1            ; <i32> [#uses=1]
28         %tmp2 = add i32 %tmp, 1         ; <i32> [#uses=2]
29         %tmp4 = icmp ugt i32 %tmp2, %tmp26              ; <i1> [#uses=1]
30         %umax = select i1 %tmp4, i32 %tmp2, i32 %tmp26          ; <i32> [#uses=1]
31         %tmp5 = sub i32 0, %tmp         ; <i32> [#uses=1]
32         %tmp6 = add i32 %umax, %tmp5            ; <i32> [#uses=1]
33         br label %bb
34
35 bb:             ; preds = %bb25, %bb.preheader
36         %indvar = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb25 ]         ; <i32> [#uses=2]
37         %T1.tmp.1 = phi i32 [ %T1.promoted, %bb.preheader ], [ %T1.tmp.0, %bb25 ]               ; <i32> [#uses=3]
38         %tj.01.0 = add i32 %indvar, %tmp                ; <i32> [#uses=3]
39         %tmp24 = add i32 %tj.01.0, 1            ; <i32> [#uses=1]
40         %tmp3 = icmp eq i32 %tmp24, %tmp1               ; <i1> [#uses=1]
41         br i1 %tmp3, label %cond_true, label %bb25
42
43 cond_true:              ; preds = %bb
44         %tmp7 = getelementptr [100 x %struct.anon]* @Y, i32 0, i32 %tj.01.0, i32 0              ; <i32*> [#uses=1]
45         %tmp8 = load i32* %tmp7, align 4                ; <i32> [#uses=1]
46         %tmp9 = icmp sgt i32 %tmp8, 0           ; <i1> [#uses=1]
47         br i1 %tmp9, label %cond_true12, label %bb25
48
49 cond_true12:            ; preds = %cond_true
50         %tmp16 = getelementptr [100 x [100 x i32]]* @T2, i32 0, i32 %tmp13, i32 %tj.01.0                ; <i32*> [#uses=1]
51         %tmp17 = load i32* %tmp16, align 4              ; <i32> [#uses=1]
52         %tmp19 = mul i32 %tmp18, %tmp17         ; <i32> [#uses=1]
53         %tmp21 = add i32 %tmp19, %T1.tmp.1              ; <i32> [#uses=1]
54         br label %bb25
55
56 bb25:           ; preds = %cond_true12, %cond_true, %bb
57         %T1.tmp.0 = phi i32 [ %T1.tmp.1, %bb ], [ %T1.tmp.1, %cond_true ], [ %tmp21, %cond_true12 ]             ; <i32> [#uses=2]
58         %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=2]
59         %exitcond = icmp ne i32 %indvar.next, %tmp6             ; <i1> [#uses=1]
60         br i1 %exitcond, label %bb, label %return.loopexit
61
62 return.loopexit:                ; preds = %bb25
63         %T1.tmp.0.lcssa = phi i32 [ %T1.tmp.0, %bb25 ]          ; <i32> [#uses=1]
64         store i32 %T1.tmp.0.lcssa, i32* @T1
65         br label %return
66
67 return:         ; preds = %return.loopexit, %entry
68         ret void
69 }