1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s
6 ; FIXME: Range of phi_1 and phi_2 here can be sharpened to [10, 21).
7 define void @test_01() {
8 ; CHECK-LABEL: 'test_01'
9 ; CHECK-NEXT: Classifying expressions for: @test_01
10 ; CHECK-NEXT: %phi_1 = phi i32 [ 10, %entry ], [ %phi_2, %loop ]
11 ; CHECK-NEXT: --> %phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
12 ; CHECK-NEXT: %phi_2 = phi i32 [ 20, %entry ], [ %phi_1, %loop ]
13 ; CHECK-NEXT: --> %phi_2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
14 ; CHECK-NEXT: %cond = call i1 @cond()
15 ; CHECK-NEXT: --> %cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %loop: Variant }
16 ; CHECK-NEXT: Determining loop execution counts for: @test_01
17 ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count.
18 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
19 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
20 ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count.
26 %phi_1 = phi i32 [ 10, %entry], [%phi_2, %loop]
27 %phi_2 = phi i32 [ 20, %entry], [%phi_1, %loop]
28 %cond = call i1 @cond()
29 br i1 %cond, label %loop, label %exit
35 ; FIXME: Both inner and outer loop Phis should have the same range [0, 3000).
36 define void @test_02(ptr %p, ptr %q) {
37 ; CHECK-LABEL: 'test_02'
38 ; CHECK-NEXT: Classifying expressions for: @test_02
39 ; CHECK-NEXT: %start = load i32, ptr %p, align 4, !range !0
40 ; CHECK-NEXT: --> %start U: [0,1000) S: [0,1000)
41 ; CHECK-NEXT: %outer_phi = phi i32 [ %start, %entry ], [ %inner_lcssa, %outer_backedge ]
42 ; CHECK-NEXT: --> %outer_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
43 ; CHECK-NEXT: %inner_phi = phi i32 [ %outer_phi, %outer_loop ], [ %inner_load, %inner_loop ]
44 ; CHECK-NEXT: --> %inner_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
45 ; CHECK-NEXT: %inner_load = load i32, ptr %q, align 4, !range !1
46 ; CHECK-NEXT: --> %inner_load U: [2000,3000) S: [2000,3000) Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
47 ; CHECK-NEXT: %inner_cond = call i1 @cond()
48 ; CHECK-NEXT: --> %inner_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
49 ; CHECK-NEXT: %inner_lcssa = phi i32 [ %inner_phi, %inner_loop ]
50 ; CHECK-NEXT: --> %inner_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Variant }
51 ; CHECK-NEXT: %outer_cond = call i1 @cond()
52 ; CHECK-NEXT: --> %outer_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
53 ; CHECK-NEXT: Determining loop execution counts for: @test_02
54 ; CHECK-NEXT: Loop %inner_loop: Unpredictable backedge-taken count.
55 ; CHECK-NEXT: Loop %inner_loop: Unpredictable constant max backedge-taken count.
56 ; CHECK-NEXT: Loop %inner_loop: Unpredictable symbolic max backedge-taken count.
57 ; CHECK-NEXT: Loop %inner_loop: Unpredictable predicated backedge-taken count.
58 ; CHECK-NEXT: Loop %outer_loop: Unpredictable backedge-taken count.
59 ; CHECK-NEXT: Loop %outer_loop: Unpredictable constant max backedge-taken count.
60 ; CHECK-NEXT: Loop %outer_loop: Unpredictable symbolic max backedge-taken count.
61 ; CHECK-NEXT: Loop %outer_loop: Unpredictable predicated backedge-taken count.
64 %start = load i32, ptr %p, !range !0
68 %outer_phi = phi i32 [ %start, %entry], [%inner_lcssa, %outer_backedge]
72 %inner_phi = phi i32 [%outer_phi, %outer_loop], [%inner_load, %inner_loop]
73 %inner_load = load i32, ptr %q, !range !1
74 %inner_cond = call i1 @cond()
75 br i1 %inner_cond, label %inner_loop, label %outer_backedge
78 %inner_lcssa = phi i32 [%inner_phi, %inner_loop]
79 %outer_cond = call i1 @cond()
80 br i1 %outer_cond, label %outer_loop, label %exit
86 ; FIXME: All phis should have range [0, 3000)
87 define void @test_03(ptr %p, ptr %q) {
88 ; CHECK-LABEL: 'test_03'
89 ; CHECK-NEXT: Classifying expressions for: @test_03
90 ; CHECK-NEXT: %start_1 = load i32, ptr %p, align 4, !range !0
91 ; CHECK-NEXT: --> %start_1 U: [0,1000) S: [0,1000)
92 ; CHECK-NEXT: %start_2 = load i32, ptr %q, align 4, !range !1
93 ; CHECK-NEXT: --> %start_2 U: [2000,3000) S: [2000,3000)
94 ; CHECK-NEXT: %outer_phi = phi i32 [ %start_1, %entry ], [ %inner_lcssa, %outer_backedge ]
95 ; CHECK-NEXT: --> %outer_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
96 ; CHECK-NEXT: %inner_phi_1 = phi i32 [ %outer_phi, %outer_loop ], [ %inner_phi_2, %inner_loop ]
97 ; CHECK-NEXT: --> %inner_phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
98 ; CHECK-NEXT: %inner_phi_2 = phi i32 [ %start_2, %outer_loop ], [ %inner_phi_1, %inner_loop ]
99 ; CHECK-NEXT: --> %inner_phi_2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
100 ; CHECK-NEXT: %inner_cond = call i1 @cond()
101 ; CHECK-NEXT: --> %inner_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
102 ; CHECK-NEXT: %inner_lcssa = phi i32 [ %inner_phi_1, %inner_loop ]
103 ; CHECK-NEXT: --> %inner_phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Variant }
104 ; CHECK-NEXT: %outer_cond = call i1 @cond()
105 ; CHECK-NEXT: --> %outer_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
106 ; CHECK-NEXT: Determining loop execution counts for: @test_03
107 ; CHECK-NEXT: Loop %inner_loop: Unpredictable backedge-taken count.
108 ; CHECK-NEXT: Loop %inner_loop: Unpredictable constant max backedge-taken count.
109 ; CHECK-NEXT: Loop %inner_loop: Unpredictable symbolic max backedge-taken count.
110 ; CHECK-NEXT: Loop %inner_loop: Unpredictable predicated backedge-taken count.
111 ; CHECK-NEXT: Loop %outer_loop: Unpredictable backedge-taken count.
112 ; CHECK-NEXT: Loop %outer_loop: Unpredictable constant max backedge-taken count.
113 ; CHECK-NEXT: Loop %outer_loop: Unpredictable symbolic max backedge-taken count.
114 ; CHECK-NEXT: Loop %outer_loop: Unpredictable predicated backedge-taken count.
117 %start_1 = load i32, ptr %p, !range !0
118 %start_2 = load i32, ptr %q, !range !1
122 %outer_phi = phi i32 [ %start_1, %entry], [%inner_lcssa, %outer_backedge]
126 %inner_phi_1 = phi i32 [%outer_phi, %outer_loop], [%inner_phi_2, %inner_loop]
127 %inner_phi_2 = phi i32 [%start_2, %outer_loop], [%inner_phi_1, %inner_loop]
128 %inner_cond = call i1 @cond()
129 br i1 %inner_cond, label %inner_loop, label %outer_backedge
132 %inner_lcssa = phi i32 [%inner_phi_1, %inner_loop]
133 %outer_cond = call i1 @cond()
134 br i1 %outer_cond, label %outer_loop, label %exit
140 !0 = !{i32 0, i32 1000}
141 !1 = !{i32 2000, i32 3000}