llvm.org GIT mirror llvm / 549a67c
[SCEV] Un-grep'ify tests; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277861 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjoy Das 3 years ago
2 changed file(s) with 50 addition(s) and 42 deletion(s). Raw diff Collapse all Expand all
None ; RUN: opt < %s -analyze -scalar-evolution > %t
1 ; RUN: grep "sext i57 {0,+,199}<%bb> to i64" %t | count 1
2 ; RUN: grep "sext i59 {0,+,199}<%bb> to i64" %t | count 1
0 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
31
42 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
53 target triple = "i386-apple-darwin9.6"
64
75 define i64 @foo(i64* nocapture %x, i64 %n) nounwind {
6 ; CHECK-LABEL: Classifying expressions for: @foo
87 entry:
9 %t0 = icmp sgt i64 %n, 0 ; [#uses=1]
8 %t0 = icmp sgt i64 %n, 0
109 br i1 %t0, label %bb, label %return
1110
12 bb: ; preds = %bb, %entry
13 %i.01 = phi i64 [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=2]
14 %t1 = shl i64 %i.01, 7 ; [#uses=1]
15 %t2 = ashr i64 %t1, 7 ; [#uses=1]
16 %s1 = shl i64 %i.01, 5 ; [#uses=1]
17 %s2 = ashr i64 %s1, 5 ; [#uses=1]
18 %t3 = getelementptr i64, i64* %x, i64 %i.01 ; [#uses=1]
11 bb:
12 %i.01 = phi i64 [ 0, %entry ], [ %indvar.next, %bb ]
13 %t1 = shl i64 %i.01, 7
14 %t2 = ashr i64 %t1, 7
15 ; CHECK: %t2 = ashr i64 %t1, 7
16 ; CHECK-NEXT: sext i57 {0,+,199}<%bb> to i64
17 ; CHECK-NOT: i57
18 ; CHECK: %s2 = ashr i64 %s1, 5
19 ; CHECK-NEXT: sext i59 {0,+,199}<%bb> to i64
20 ; CHECK-NOT: i59
21 %s1 = shl i64 %i.01, 5
22 %s2 = ashr i64 %s1, 5
23 %t3 = getelementptr i64, i64* %x, i64 %i.01
1924 store i64 0, i64* %t3, align 1
20 %indvar.next = add i64 %i.01, 199 ; [#uses=2]
21 %exitcond = icmp eq i64 %indvar.next, %n ; [#uses=1]
25 %indvar.next = add i64 %i.01, 199
26 %exitcond = icmp eq i64 %indvar.next, %n
2227 br i1 %exitcond, label %return, label %bb
2328
24 return: ; preds = %bb, %entry
29 return:
2530 %p = phi i64 [ 0, %entry ], [ %t2, %bb ]
2631 %q = phi i64 [ 0, %entry ], [ %s2, %bb ]
2732 %v = xor i64 %p, %q
None ; RUN: opt < %s -analyze -scalar-evolution > %t
1 ; RUN: grep sext %t | count 2
2 ; RUN: not grep "(sext" %t
0 ; RUN: opt < %s -analyze -scalar-evolution | FileCheck %s
31
42 ; ScalarEvolution should be able to compute a maximum trip count
53 ; value sufficient to fold away both sext casts.
75 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
86
97 define float @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bim) nounwind {
8 ; CHECK-LABEL: Classifying expressions for: @t
109 entry:
11 %tmp3 = load float, float* %peakWeight, align 4 ; [#uses=2]
12 %tmp2538 = icmp sgt i32 %bim, 0 ; [#uses=1]
10 %tmp3 = load float, float* %peakWeight, align 4
11 %tmp2538 = icmp sgt i32 %bim, 0
1312 br i1 %tmp2538, label %bb.nph, label %bb4
1413
15 bb.nph: ; preds = %entry
14 bb.nph:
1615 br label %bb
1716
18 bb: ; preds = %bb1, %bb.nph
19 %distERBhi.036 = phi float [ %tmp10, %bb1 ], [ 0.000000e+00, %bb.nph ] ; [#uses=1]
20 %hiPart.035 = phi i32 [ %tmp12, %bb1 ], [ 0, %bb.nph ] ; [#uses=2]
21 %peakCount.034 = phi float [ %tmp19, %bb1 ], [ %tmp3, %bb.nph ] ; [#uses=1]
22 %tmp6 = sext i32 %hiPart.035 to i64 ; [#uses=1]
23 %tmp7 = getelementptr float, float* %pTmp1, i64 %tmp6 ; [#uses=1]
24 %tmp8 = load float, float* %tmp7, align 4 ; [#uses=1]
25 %tmp10 = fadd float %tmp8, %distERBhi.036 ; [#uses=3]
26 %tmp12 = add i32 %hiPart.035, 1 ; [#uses=3]
27 %tmp15 = sext i32 %tmp12 to i64 ; [#uses=1]
28 %tmp16 = getelementptr float, float* %peakWeight, i64 %tmp15 ; [#uses=1]
29 %tmp17 = load float, float* %tmp16, align 4 ; [#uses=1]
30 %tmp19 = fadd float %tmp17, %peakCount.034 ; [#uses=2]
17 bb:
18 %distERBhi.036 = phi float [ %tmp10, %bb1 ], [ 0.000000e+00, %bb.nph ]
19 %hiPart.035 = phi i32 [ %tmp12, %bb1 ], [ 0, %bb.nph ]
20 %peakCount.034 = phi float [ %tmp19, %bb1 ], [ %tmp3, %bb.nph ]
21 %tmp6 = sext i32 %hiPart.035 to i64
22 %tmp7 = getelementptr float, float* %pTmp1, i64 %tmp6
23 ; CHECK: %tmp6 = sext i32 %hiPart.035 to i64
24 ; CHECK-NEXT: --> {0,+,1}<%bb>
25 %tmp8 = load float, float* %tmp7, align 4
26 %tmp10 = fadd float %tmp8, %distERBhi.036
27 %tmp12 = add i32 %hiPart.035, 1
28 %tmp15 = sext i32 %tmp12 to i64
29 %tmp16 = getelementptr float, float* %peakWeight, i64 %tmp15
30 ; CHECK: %tmp15 = sext i32 %tmp12 to i64
31 ; CHECK-NEXT: --> {1,+,1}<%bb>
32 %tmp17 = load float, float* %tmp16, align 4
33 %tmp19 = fadd float %tmp17, %peakCount.034
3134 br label %bb1
3235
33 bb1: ; preds = %bb
34 %tmp21 = fcmp olt float %tmp10, 2.500000e+00 ; [#uses=1]
35 %tmp25 = icmp slt i32 %tmp12, %bim ; [#uses=1]
36 %tmp27 = and i1 %tmp21, %tmp25 ; [#uses=1]
36 bb1:
37 %tmp21 = fcmp olt float %tmp10, 2.500000e+00
38 %tmp25 = icmp slt i32 %tmp12, %bim
39 %tmp27 = and i1 %tmp21, %tmp25
3740 br i1 %tmp27, label %bb, label %bb1.bb4_crit_edge
3841
39 bb1.bb4_crit_edge: ; preds = %bb1
42 bb1.bb4_crit_edge:
4043 br label %bb4
4144
42 bb4: ; preds = %bb1.bb4_crit_edge, %entry
43 %distERBhi.0.lcssa = phi float [ %tmp10, %bb1.bb4_crit_edge ], [ 0.000000e+00, %entry ] ; [#uses=1]
44 %peakCount.0.lcssa = phi float [ %tmp19, %bb1.bb4_crit_edge ], [ %tmp3, %entry ] ; [#uses=1]
45 %tmp31 = fdiv float %peakCount.0.lcssa, %distERBhi.0.lcssa ; [#uses=1]
45 bb4:
46 %distERBhi.0.lcssa = phi float [ %tmp10, %bb1.bb4_crit_edge ], [ 0.000000e+00, %entry ]
47 %peakCount.0.lcssa = phi float [ %tmp19, %bb1.bb4_crit_edge ], [ %tmp3, %entry ]
48 %tmp31 = fdiv float %peakCount.0.lcssa, %distERBhi.0.lcssa
4649 ret float %tmp31
4750 }