@@ -34,9 +34,10 @@ while.end:
34
34
ret void
35
35
}
36
36
37
- define dso_local void @overflow (i32 noundef %n ) local_unnamed_addr {
38
- ; CHECK-LABEL: 'overflow'
39
- ; CHECK-NEXT: Classifying expressions for: @overflow
37
+ ; Cannot find backedge-count because subtraction of strides is wrapping.
38
+ define dso_local void @stride_overflow (i32 noundef %n ) local_unnamed_addr {
39
+ ; CHECK-LABEL: 'stride_overflow'
40
+ ; CHECK-NEXT: Classifying expressions for: @stride_overflow
40
41
; CHECK-NEXT: %right.06 = phi i32 [ %dec, %while.body ], [ %n, %entry ]
41
42
; CHECK-NEXT: --> {%n,+,-1}<nsw><%while.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
42
43
; CHECK-NEXT: %left.05 = phi i32 [ %inc, %while.body ], [ 2147483647, %entry ]
@@ -45,7 +46,7 @@ define dso_local void @overflow(i32 noundef %n) local_unnamed_addr {
45
46
; CHECK-NEXT: --> {-2,+,2147483647}<nuw><nsw><%while.body> U: [-2,-1) S: [-2,0) Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
46
47
; CHECK-NEXT: %dec = add nsw i32 %right.06, -1
47
48
; CHECK-NEXT: --> {(-1 + %n),+,-1}<nsw><%while.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
48
- ; CHECK-NEXT: Determining loop execution counts for: @overflow
49
+ ; CHECK-NEXT: Determining loop execution counts for: @stride_overflow
49
50
; CHECK-NEXT: Loop %while.body: Unpredictable backedge-taken count.
50
51
; CHECK-NEXT: Loop %while.body: constant max backedge-taken count is i32 1
51
52
; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is i32 1
@@ -66,4 +67,39 @@ while.end:
66
67
ret void
67
68
}
68
69
70
+ ; Cannot find backedge-count because %conv110 is wrapping
71
+ define dso_local void @rhs_wrapping () local_unnamed_addr {
72
+ ; CHECK-LABEL: 'rhs_wrapping'
73
+ ; CHECK-NEXT: Classifying expressions for: @rhs_wrapping
74
+ ; CHECK-NEXT: %a = alloca i8, align 1
75
+ ; CHECK-NEXT: --> %a U: full-set S: full-set
76
+ ; CHECK-NEXT: %conv110 = phi i32 [ 0, %entry ], [ %sext8, %while.body ]
77
+ ; CHECK-NEXT: --> {0,+,-1090519040}<%while.body> U: [0,-16777215) S: [-2147483648,2130706433) Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
78
+ ; CHECK-NEXT: %conv9 = phi i32 [ -2147483648, %entry ], [ %sext, %while.body ]
79
+ ; CHECK-NEXT: --> {-2147483648,+,16777216}<nsw><%while.body> U: [0,-16777215) S: [-2147483648,2113929217) Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
80
+ ; CHECK-NEXT: %sext = add nsw i32 %conv9, 16777216
81
+ ; CHECK-NEXT: --> {-2130706432,+,16777216}<nsw><%while.body> U: [0,-16777215) S: [-2130706432,2130706433) Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
82
+ ; CHECK-NEXT: %sext8 = add i32 %conv110, -1090519040
83
+ ; CHECK-NEXT: --> {-1090519040,+,-1090519040}<%while.body> U: [0,-16777215) S: [-2147483648,2130706433) Exits: <<Unknown>> LoopDispositions: { %while.body: Computable }
84
+ ; CHECK-NEXT: Determining loop execution counts for: @rhs_wrapping
85
+ ; CHECK-NEXT: Loop %while.body: Unpredictable backedge-taken count.
86
+ ; CHECK-NEXT: Loop %while.body: constant max backedge-taken count is i32 254
87
+ ; CHECK-NEXT: Loop %while.body: symbolic max backedge-taken count is i32 254
88
+ ;
89
+ entry:
90
+ %a = alloca i8 , align 1
91
+ br label %while.body
92
+
93
+ while.body:
94
+ %conv110 = phi i32 [ 0 , %entry ], [ %sext8 , %while.body ]
95
+ %conv9 = phi i32 [ -2147483648 , %entry ], [ %sext , %while.body ]
96
+ %sext = add nsw i32 %conv9 , 16777216
97
+ %sext8 = add i32 %conv110 , -1090519040
98
+ %cmp = icmp slt i32 %sext , %sext8
99
+ br i1 %cmp , label %while.body , label %while.end
100
+
101
+ while.end:
102
+ ret void
103
+ }
104
+
69
105
0 commit comments