1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py
2 ; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
8 ; CHECK-NEXT: Classifying expressions for: @f0
9 ; CHECK-NEXT: %v0 = phi i16 [ 2, %b0 ], [ %v2, %b1 ]
10 ; CHECK-NEXT: --> {2,+,1}<nuw><nsw><%b1> U: [2,4) S: [2,4) Exits: 3 LoopDispositions: { %b1: Computable }
11 ; CHECK-NEXT: %v1 = phi i16 [ 1, %b0 ], [ %v3, %b1 ]
12 ; CHECK-NEXT: --> {1,+,2,+,1}<%b1> U: full-set S: full-set Exits: 3 LoopDispositions: { %b1: Computable }
13 ; CHECK-NEXT: %v2 = add nsw i16 %v0, 1
14 ; CHECK-NEXT: --> {3,+,1}<nuw><nsw><%b1> U: [3,5) S: [3,5) Exits: 4 LoopDispositions: { %b1: Computable }
15 ; CHECK-NEXT: %v3 = add nsw i16 %v1, %v0
16 ; CHECK-NEXT: --> {3,+,3,+,1}<%b1> U: full-set S: full-set Exits: 6 LoopDispositions: { %b1: Computable }
17 ; CHECK-NEXT: %v4 = and i16 %v3, 1
18 ; CHECK-NEXT: --> (zext i1 {true,+,true,+,true}<%b1> to i16) U: [0,2) S: [0,2) Exits: 0 LoopDispositions: { %b1: Computable }
19 ; CHECK-NEXT: Determining loop execution counts for: @f0
20 ; CHECK-NEXT: Loop %b1: backedge-taken count is 1
21 ; CHECK-NEXT: Loop %b1: constant max backedge-taken count is 1
22 ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 1
23 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 1
24 ; CHECK-NEXT: Predicates:
25 ; CHECK-NEXT: Loop %b1: Trip multiple is 2
30 b1: ; preds = %b1, %b0
31 %v0 = phi i16 [ 2, %b0 ], [ %v2, %b1 ]
32 %v1 = phi i16 [ 1, %b0 ], [ %v3, %b1 ]
33 %v2 = add nsw i16 %v0, 1
34 %v3 = add nsw i16 %v1, %v0
36 %v5 = icmp ne i16 %v4, 0
37 br i1 %v5, label %b1, label %b2
43 @g0 = common dso_local global i16 0, align 2
44 @g1 = common dso_local global i32 0, align 4
45 @g2 = common dso_local global ptr null, align 8
47 define void @f1() #0 {
49 ; CHECK-NEXT: Classifying expressions for: @f1
50 ; CHECK-NEXT: %v0 = phi i16 [ 0, %b0 ], [ %v3, %b1 ]
51 ; CHECK-NEXT: --> {0,+,3,+,1}<%b1> U: full-set S: full-set Exits: 7 LoopDispositions: { %b1: Computable }
52 ; CHECK-NEXT: %v1 = phi i32 [ 3, %b0 ], [ %v6, %b1 ]
53 ; CHECK-NEXT: --> {3,+,1}<nuw><nsw><%b1> U: [3,6) S: [3,6) Exits: 5 LoopDispositions: { %b1: Computable }
54 ; CHECK-NEXT: %v2 = trunc i32 %v1 to i16
55 ; CHECK-NEXT: --> {3,+,1}<%b1> U: [3,6) S: [3,6) Exits: 5 LoopDispositions: { %b1: Computable }
56 ; CHECK-NEXT: %v3 = add i16 %v0, %v2
57 ; CHECK-NEXT: --> {3,+,4,+,1}<%b1> U: full-set S: full-set Exits: 12 LoopDispositions: { %b1: Computable }
58 ; CHECK-NEXT: %v4 = and i16 %v3, 1
59 ; CHECK-NEXT: --> (zext i1 {true,+,false,+,true}<%b1> to i16) U: [0,2) S: [0,2) Exits: 0 LoopDispositions: { %b1: Computable }
60 ; CHECK-NEXT: %v6 = add nuw nsw i32 %v1, 1
61 ; CHECK-NEXT: --> {4,+,1}<nuw><nsw><%b1> U: [4,7) S: [4,7) Exits: 6 LoopDispositions: { %b1: Computable }
62 ; CHECK-NEXT: %v7 = phi i32 [ %v1, %b1 ]
63 ; CHECK-NEXT: --> {3,+,1}<nuw><nsw><%b1> U: [3,6) S: [3,6) --> 5 U: [5,6) S: [5,6)
64 ; CHECK-NEXT: %v8 = phi i16 [ %v3, %b1 ]
65 ; CHECK-NEXT: --> {3,+,4,+,1}<%b1> U: full-set S: full-set --> 12 U: [12,13) S: [12,13)
66 ; CHECK-NEXT: Determining loop execution counts for: @f1
67 ; CHECK-NEXT: Loop %b3: <multiple exits> Unpredictable backedge-taken count.
68 ; CHECK-NEXT: Loop %b3: Unpredictable constant max backedge-taken count.
69 ; CHECK-NEXT: Loop %b3: Unpredictable symbolic max backedge-taken count.
70 ; CHECK-NEXT: Loop %b3: Unpredictable predicated backedge-taken count.
71 ; CHECK-NEXT: Loop %b1: backedge-taken count is 2
72 ; CHECK-NEXT: Loop %b1: constant max backedge-taken count is 2
73 ; CHECK-NEXT: Loop %b1: symbolic max backedge-taken count is 2
74 ; CHECK-NEXT: Loop %b1: Predicated backedge-taken count is 2
75 ; CHECK-NEXT: Predicates:
76 ; CHECK-NEXT: Loop %b1: Trip multiple is 3
79 store i16 0, ptr @g0, align 2
80 store ptr @g1, ptr @g2, align 8
83 b1: ; preds = %b1, %b0
84 %v0 = phi i16 [ 0, %b0 ], [ %v3, %b1 ]
85 %v1 = phi i32 [ 3, %b0 ], [ %v6, %b1 ]
86 %v2 = trunc i32 %v1 to i16
87 %v3 = add i16 %v0, %v2
89 %v5 = icmp eq i16 %v4, 0
90 %v6 = add nuw nsw i32 %v1, 1
91 br i1 %v5, label %b2, label %b1
94 %v7 = phi i32 [ %v1, %b1 ]
95 %v8 = phi i16 [ %v3, %b1 ]
96 store i32 %v7, ptr @g1, align 4
97 store i16 %v8, ptr @g0, align 2
100 b3: ; preds = %b3, %b2
104 attributes #0 = { nounwind uwtable "target-cpu"="x86-64" }