1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" -S < %s 2>&1 | FileCheck %s
4 ; The exit value from this loop was originally calculated as 0.
5 ; The actual exit condition is 256*256 == 0 (in i16).
7 @g0 = global i32 0, align 4
8 @g1 = global i16 0, align 2
10 define signext i32 @f0() {
12 ; CHECK-NEXT: Classifying expressions for: @f0
13 ; CHECK-NEXT: %v1 = phi i16 [ 0, %b0 ], [ %v2, %b1 ]
14 ; CHECK-NEXT: --> {0,+,-1}<nsw><%b1> U: [-255,1) S: [-255,1) Exits: -255 LoopDispositions: { %b1: Computable }
15 ; CHECK-NEXT: %v2 = add i16 %v1, -1
16 ; CHECK-NEXT: --> {-1,+,-1}<nsw><%b1> U: [-256,0) S: [-256,0) Exits: -256 LoopDispositions: { %b1: Computable }
17 ; CHECK-NEXT: %v3 = mul i16 %v2, %v2
18 ; CHECK-NEXT: --> {1,+,3,+,2}<%b1> U: full-set S: full-set Exits: 0 LoopDispositions: { %b1: Computable }
19 ; CHECK-NEXT: %v5 = phi i16 [ %v2, %b1 ]
20 ; CHECK-NEXT: --> {-1,+,-1}<nsw><%b1> U: [-256,0) S: [-256,0) --> -256 U: [-256,-255) S: [-256,-255)
21 ; CHECK-NEXT: %v6 = phi i16 [ %v3, %b1 ]
22 ; CHECK-NEXT: --> {1,+,3,+,2}<%b1> U: full-set S: full-set --> 0 U: [0,1) S: [0,1)
23 ; CHECK-NEXT: %v7 = sext i16 %v5 to i32
24 ; CHECK-NEXT: --> {-1,+,-1}<nsw><%b1> U: [-256,0) S: [-256,0) --> -256 U: [-256,-255) S: [-256,-255)
25 ; CHECK-NEXT: Determining loop execution counts for: @f0
26 ; CHECK-NEXT: Loop %b1: backedge-taken count is 255
27 ; CHECK-NEXT: Loop %b1: constant max backedge-taken count is 255
28 ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 255
29 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 255
30 ; CHECK-NEXT: Predicates:
31 ; CHECK-NEXT: Loop %b1: Trip multiple is 256
36 b1: ; preds = %b1, %b0
37 %v1 = phi i16 [ 0, %b0 ], [ %v2, %b1 ]
39 %v3 = mul i16 %v2, %v2
40 %v4 = icmp eq i16 %v3, 0
41 br i1 %v4, label %b2, label %b1
44 %v5 = phi i16 [ %v2, %b1 ]
45 %v6 = phi i16 [ %v3, %b1 ]
46 %v7 = sext i16 %v5 to i32
47 store i32 %v7, ptr @g0, align 4
48 store i16 %v6, ptr @g1, align 2