Use WriteAsOperand instead of getName() to print loop header names,
[oota-llvm.git] / test / Analysis / ScalarEvolution / nsw.ll
1 ; RUN: opt < %s -analyze -scalar-evolution -disable-output | grep { -->  {.*,+,.*}<%bb>} | count 8
2
3 ; The addrecs in this loop are analyzable only by using nsw information.
4
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"
6
7 define void @foo(double* %p) nounwind {
8 entry:
9         %tmp = load double* %p, align 8         ; <double> [#uses=1]
10         %tmp1 = fcmp ogt double %tmp, 2.000000e+00              ; <i1> [#uses=1]
11         br i1 %tmp1, label %bb.nph, label %return
12
13 bb.nph:         ; preds = %entry
14         br label %bb
15
16 bb:             ; preds = %bb1, %bb.nph
17         %i.01 = phi i32 [ %tmp8, %bb1 ], [ 0, %bb.nph ]         ; <i32> [#uses=3]
18         %tmp2 = sext i32 %i.01 to i64           ; <i64> [#uses=1]
19         %tmp3 = getelementptr double* %p, i64 %tmp2             ; <double*> [#uses=1]
20         %tmp4 = load double* %tmp3, align 8             ; <double> [#uses=1]
21         %tmp5 = fmul double %tmp4, 9.200000e+00         ; <double> [#uses=1]
22         %tmp6 = sext i32 %i.01 to i64           ; <i64> [#uses=1]
23         %tmp7 = getelementptr double* %p, i64 %tmp6             ; <double*> [#uses=1]
24         store double %tmp5, double* %tmp7, align 8
25         %tmp8 = add nsw i32 %i.01, 1            ; <i32> [#uses=2]
26         br label %bb1
27
28 bb1:            ; preds = %bb
29         %phitmp = sext i32 %tmp8 to i64         ; <i64> [#uses=1]
30         %tmp9 = getelementptr double* %p, i64 %phitmp           ; <double*> [#uses=1]
31         %tmp10 = load double* %tmp9, align 8            ; <double> [#uses=1]
32         %tmp11 = fcmp ogt double %tmp10, 2.000000e+00           ; <i1> [#uses=1]
33         br i1 %tmp11, label %bb, label %bb1.return_crit_edge
34
35 bb1.return_crit_edge:           ; preds = %bb1
36         br label %return
37
38 return:         ; preds = %bb1.return_crit_edge, %entry
39         ret void
40 }