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.
25 %phi_1 = phi i32 [ 10, %entry], [%phi_2, %loop]
26 %phi_2 = phi i32 [ 20, %entry], [%phi_1, %loop]
27 %cond = call i1 @cond()
28 br i1 %cond, label %loop, label %exit
34 ; FIXME: Both inner and outer loop Phis should have the same range [0, 3000).
35 define void @test_02(ptr %p, ptr %q) {
36 ; CHECK-LABEL: 'test_02'
37 ; CHECK-NEXT: Classifying expressions for: @test_02
38 ; CHECK-NEXT: %start = load i32, ptr %p, align 4, !range !0
39 ; CHECK-NEXT: --> %start U: [0,1000) S: [0,1000)
40 ; CHECK-NEXT: %outer_phi = phi i32 [ %start, %entry ], [ %inner_lcssa, %outer_backedge ]
41 ; CHECK-NEXT: --> %outer_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
42 ; CHECK-NEXT: %inner_phi = phi i32 [ %outer_phi, %outer_loop ], [ %inner_load, %inner_loop ]
43 ; CHECK-NEXT: --> %inner_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
44 ; CHECK-NEXT: %inner_load = load i32, ptr %q, align 4, !range !1
45 ; CHECK-NEXT: --> %inner_load U: [2000,3000) S: [2000,3000) Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
46 ; CHECK-NEXT: %inner_cond = call i1 @cond()
47 ; CHECK-NEXT: --> %inner_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
48 ; CHECK-NEXT: %inner_lcssa = phi i32 [ %inner_phi, %inner_loop ]
49 ; CHECK-NEXT: --> %inner_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Variant }
50 ; CHECK-NEXT: %outer_cond = call i1 @cond()
51 ; CHECK-NEXT: --> %outer_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
52 ; CHECK-NEXT: Determining loop execution counts for: @test_02
53 ; CHECK-NEXT: Loop %inner_loop: Unpredictable backedge-taken count.
54 ; CHECK-NEXT: Loop %inner_loop: Unpredictable constant max backedge-taken count.
55 ; CHECK-NEXT: Loop %inner_loop: Unpredictable symbolic max backedge-taken count.
56 ; CHECK-NEXT: Loop %outer_loop: Unpredictable backedge-taken count.
57 ; CHECK-NEXT: Loop %outer_loop: Unpredictable constant max backedge-taken count.
58 ; CHECK-NEXT: Loop %outer_loop: Unpredictable symbolic max backedge-taken count.
61 %start = load i32, ptr %p, !range !0
65 %outer_phi = phi i32 [ %start, %entry], [%inner_lcssa, %outer_backedge]
69 %inner_phi = phi i32 [%outer_phi, %outer_loop], [%inner_load, %inner_loop]
70 %inner_load = load i32, ptr %q, !range !1
71 %inner_cond = call i1 @cond()
72 br i1 %inner_cond, label %inner_loop, label %outer_backedge
75 %inner_lcssa = phi i32 [%inner_phi, %inner_loop]
76 %outer_cond = call i1 @cond()
77 br i1 %outer_cond, label %outer_loop, label %exit
83 ; FIXME: All phis should have range [0, 3000)
84 define void @test_03(ptr %p, ptr %q) {
85 ; CHECK-LABEL: 'test_03'
86 ; CHECK-NEXT: Classifying expressions for: @test_03
87 ; CHECK-NEXT: %start_1 = load i32, ptr %p, align 4, !range !0
88 ; CHECK-NEXT: --> %start_1 U: [0,1000) S: [0,1000)
89 ; CHECK-NEXT: %start_2 = load i32, ptr %q, align 4, !range !1
90 ; CHECK-NEXT: --> %start_2 U: [2000,3000) S: [2000,3000)
91 ; CHECK-NEXT: %outer_phi = phi i32 [ %start_1, %entry ], [ %inner_lcssa, %outer_backedge ]
92 ; CHECK-NEXT: --> %outer_phi U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
93 ; CHECK-NEXT: %inner_phi_1 = phi i32 [ %outer_phi, %outer_loop ], [ %inner_phi_2, %inner_loop ]
94 ; CHECK-NEXT: --> %inner_phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
95 ; CHECK-NEXT: %inner_phi_2 = phi i32 [ %start_2, %outer_loop ], [ %inner_phi_1, %inner_loop ]
96 ; CHECK-NEXT: --> %inner_phi_2 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
97 ; CHECK-NEXT: %inner_cond = call i1 @cond()
98 ; CHECK-NEXT: --> %inner_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner_loop: Variant, %outer_loop: Variant }
99 ; CHECK-NEXT: %inner_lcssa = phi i32 [ %inner_phi_1, %inner_loop ]
100 ; CHECK-NEXT: --> %inner_phi_1 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Variant }
101 ; CHECK-NEXT: %outer_cond = call i1 @cond()
102 ; CHECK-NEXT: --> %outer_cond U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer_loop: Variant, %inner_loop: Invariant }
103 ; CHECK-NEXT: Determining loop execution counts for: @test_03
104 ; CHECK-NEXT: Loop %inner_loop: Unpredictable backedge-taken count.
105 ; CHECK-NEXT: Loop %inner_loop: Unpredictable constant max backedge-taken count.
106 ; CHECK-NEXT: Loop %inner_loop: Unpredictable symbolic max backedge-taken count.
107 ; CHECK-NEXT: Loop %outer_loop: Unpredictable backedge-taken count.
108 ; CHECK-NEXT: Loop %outer_loop: Unpredictable constant max backedge-taken count.
109 ; CHECK-NEXT: Loop %outer_loop: Unpredictable symbolic max backedge-taken count.
112 %start_1 = load i32, ptr %p, !range !0
113 %start_2 = load i32, ptr %q, !range !1
117 %outer_phi = phi i32 [ %start_1, %entry], [%inner_lcssa, %outer_backedge]
121 %inner_phi_1 = phi i32 [%outer_phi, %outer_loop], [%inner_phi_2, %inner_loop]
122 %inner_phi_2 = phi i32 [%start_2, %outer_loop], [%inner_phi_1, %inner_loop]
123 %inner_cond = call i1 @cond()
124 br i1 %inner_cond, label %inner_loop, label %outer_backedge
127 %inner_lcssa = phi i32 [%inner_phi_1, %inner_loop]
128 %outer_cond = call i1 @cond()
129 br i1 %outer_cond, label %outer_loop, label %exit
135 !0 = !{i32 0, i32 1000}
136 !1 = !{i32 2000, i32 3000}