Make getUniqueExitBlocks's precondition assert more precise, to
[oota-llvm.git] / test / Transforms / IndVarSimplify / gep-with-mul-base.ll
1 ; RUN: opt < %s -indvars -S > %t
2 ; RUN: grep add %t | count 8
3 ; RUN: grep mul %t | count 7
4
5 define void @foo(i64 %n, i64 %m, i64 %o, double* nocapture %p) nounwind {
6 entry:
7         %tmp = icmp sgt i64 %n, 0               ; <i1> [#uses=1]
8         br i1 %tmp, label %bb.nph, label %return
9
10 bb.nph:         ; preds = %entry
11         %tmp1 = mul i64 %n, 37          ; <i64> [#uses=1]
12         %tmp2 = mul i64 %tmp1, %m               ; <i64> [#uses=1]
13         %tmp3 = mul i64 %tmp2, %o               ; <i64> [#uses=1]
14         br label %bb
15
16 bb:             ; preds = %bb, %bb.nph
17         %i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ]             ; <i64> [#uses=3]
18         %tmp9 = getelementptr double* %p, i64 %i.01             ; <double*> [#uses=1]
19         %tmp10 = load double* %tmp9, align 8            ; <double> [#uses=1]
20         %tmp11 = fdiv double %tmp10, 2.100000e+00               ; <double> [#uses=1]
21         store double %tmp11, double* %tmp9, align 8
22         %tmp13 = add i64 %i.01, 1               ; <i64> [#uses=2]
23         %tmp14 = icmp slt i64 %tmp13, %n                ; <i1> [#uses=1]
24         br i1 %tmp14, label %bb, label %return.loopexit
25
26 return.loopexit:                ; preds = %bb
27         br label %return
28
29 return:         ; preds = %return.loopexit, %entry
30         ret void
31 }
32 define void @bar(i64 %n, i64 %m, i64 %o, i64 %q, double* nocapture %p) nounwind {
33 entry:
34         %tmp = icmp sgt i64 %n, 0               ; <i1> [#uses=1]
35         br i1 %tmp, label %bb.nph, label %return
36
37 bb.nph:         ; preds = %entry
38         %tmp1 = mul i64 %n, %q          ; <i64> [#uses=1]
39         %tmp2 = mul i64 %tmp1, %m               ; <i64> [#uses=1]
40         %tmp3 = mul i64 %tmp2, %o               ; <i64> [#uses=1]
41         br label %bb
42
43 bb:             ; preds = %bb, %bb.nph
44         %i.01 = phi i64 [ %tmp3, %bb.nph ], [ %tmp13, %bb ]             ; <i64> [#uses=3]
45         %tmp9 = getelementptr double* %p, i64 %i.01             ; <double*> [#uses=1]
46         %tmp10 = load double* %tmp9, align 8            ; <double> [#uses=1]
47         %tmp11 = fdiv double %tmp10, 2.100000e+00               ; <double> [#uses=1]
48         store double %tmp11, double* %tmp9, align 8
49         %tmp13 = add i64 %i.01, 1               ; <i64> [#uses=2]
50         %tmp14 = icmp slt i64 %tmp13, %n                ; <i1> [#uses=1]
51         br i1 %tmp14, label %bb, label %return.loopexit
52
53 return.loopexit:                ; preds = %bb
54         br label %return
55
56 return:         ; preds = %return.loopexit, %entry
57         ret void
58 }