Model stacksave and stackrestore as both writing memory, since we
[oota-llvm.git] / test / Transforms / LoopIndexSplit / 2007-09-25-UpdateIterationSpace-2.ll
1 ; PR714
2 ; Update loop iteraton space to eliminate condition inside loop.
3 ; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep bothcond
4 define void @test(float* %x, i32 %ndat, float** %y, float %xcen, i32 %xmin, i32 %xmax, float %sigmal, float %contribution) {
5 entry:
6         %tmp5310 = icmp sgt i32 %xmin, %xmax            ; <i1> [#uses=1]
7         br i1 %tmp5310, label %return, label %bb.preheader
8
9 bb.preheader:           ; preds = %entry
10         %tmp3031 = fpext float %contribution to double          ; <double> [#uses=1]
11         %tmp32 = mul double %tmp3031, 5.000000e-01              ; <double> [#uses=1]
12         %tmp3839 = fpext float %sigmal to double                ; <double> [#uses=1]
13         br label %bb
14
15 bb:             ; preds = %bb.preheader, %cond_next45
16         %i.01.0 = phi i32 [ %tmp47, %cond_next45 ], [ %xmin, %bb.preheader ]            ; <i32> [#uses=4]
17         %k.06.0 = phi i32 [ %tmp49, %cond_next45 ], [ 0, %bb.preheader ]                ; <i32> [#uses=3]
18         %tmp2 = icmp sgt i32 %i.01.0, -1                ; <i1> [#uses=1]
19         %tmp6 = icmp slt i32 %i.01.0, %ndat             ; <i1> [#uses=1]
20         %bothcond = and i1 %tmp2, %tmp6         ; <i1> [#uses=1]
21         br i1 %bothcond, label %cond_true9, label %cond_next45
22
23 cond_true9:             ; preds = %bb
24         %tmp12 = getelementptr float* %x, i32 %i.01.0           ; <float*> [#uses=1]
25         %tmp13 = load float* %tmp12, align 4            ; <float> [#uses=1]
26         %tmp15 = sub float %xcen, %tmp13                ; <float> [#uses=1]
27         %tmp16 = tail call float @fabsf( float %tmp15 )         ; <float> [#uses=1]
28         %tmp18 = fdiv float %tmp16, %sigmal             ; <float> [#uses=1]
29         %tmp21 = load float** %y, align 4               ; <float*> [#uses=2]
30         %tmp27 = getelementptr float* %tmp21, i32 %k.06.0               ; <float*> [#uses=1]
31         %tmp28 = load float* %tmp27, align 4            ; <float> [#uses=1]
32         %tmp2829 = fpext float %tmp28 to double         ; <double> [#uses=1]
33         %tmp34 = sub float -0.000000e+00, %tmp18                ; <float> [#uses=1]
34         %tmp3435 = fpext float %tmp34 to double         ; <double> [#uses=1]
35         %tmp36 = tail call double @exp( double %tmp3435 )               ; <double> [#uses=1]
36         %tmp37 = mul double %tmp32, %tmp36              ; <double> [#uses=1]
37         %tmp40 = fdiv double %tmp37, %tmp3839           ; <double> [#uses=1]
38         %tmp41 = add double %tmp2829, %tmp40            ; <double> [#uses=1]
39         %tmp4142 = fptrunc double %tmp41 to float               ; <float> [#uses=1]
40         %tmp44 = getelementptr float* %tmp21, i32 %k.06.0               ; <float*> [#uses=1]
41         store float %tmp4142, float* %tmp44, align 4
42         br label %cond_next45
43
44 cond_next45:            ; preds = %bb, %cond_true9
45         %tmp47 = add i32 %i.01.0, 1             ; <i32> [#uses=2]
46         %tmp49 = add i32 %k.06.0, 1             ; <i32> [#uses=1]
47         %tmp53 = icmp sgt i32 %tmp47, %xmax             ; <i1> [#uses=1]
48         br i1 %tmp53, label %return.loopexit, label %bb
49
50 return.loopexit:                ; preds = %cond_next45
51         br label %return
52
53 return:         ; preds = %return.loopexit, %entry
54         ret void
55 }
56
57 declare float @fabsf(float)
58
59 declare double @exp(double)