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