1 ; RUN: opt -analyze -enable-new-pm=0 -scalar-evolution -scalar-evolution-max-add-rec-size=3 < %s | FileCheck %s
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-max-add-rec-size=3 < %s 2>&1 | FileCheck %s
4 ; Show that we are able to avoid creation of huge SCEVs by capping the max
6 define i32 @test_01(i32 %a, i32 %b) {
8 ; CHECK-LABEL: Classifying expressions for: @test_01
9 ; CHECK-NEXT: %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ]
10 ; CHECK-NEXT: --> {%a,+,%b}<%loop> U: full-set S: full-set
11 ; CHECK-NEXT: %iv.next = add i32 %iv, %b
12 ; CHECK-NEXT: --> {(%a + %b),+,%b}<%loop> U: full-set S: full-set
13 ; CHECK-NEXT: %x1 = mul i32 %iv, %iv.next
14 ; CHECK-NEXT: --> {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> U: full-set S: full-set
15 ; CHECK-NEXT: %x2 = mul i32 %x1, %x1
16 ; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set
17 ; CHECK-NEXT: %x3 = mul i32 %x2, %x1
18 ; CHECK-NEXT: --> ({((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop> * {((%a + %b) * %a),+,(((2 * %a) + (2 * %b)) * %b),+,(2 * %b * %b)}<%loop>) U: full-set S: full-set
24 %iv = phi i32 [ %a, %entry ], [ %iv.next, %loop ]
25 %iv.next = add i32 %iv, %b
26 %cond = icmp slt i32 %iv.next, 1000
27 br i1 %cond, label %loop, label %exit
30 %x1 = mul i32 %iv, %iv.next
31 %x2 = mul i32 %x1, %x1
32 %x3 = mul i32 %x2, %x1