Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 1 | ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py |
Arthur Eubanks | 9adbb5c | 2020-07-16 11:09:47 -0700 | [diff] [blame] | 2 | ; RUN: opt < %s -analyze -enable-new-pm=0 -scalar-evolution -scalar-evolution-classify-expressions=0 2>&1 | FileCheck %s |
| 3 | ; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 2>&1 2>&1 | FileCheck %s |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 4 | |
| 5 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 6 | target triple = "x86_64-unknown-linux-gnu" |
| 7 | |
| 8 | define void @unsimplified_and1(i32 %n) { |
| 9 | ; CHECK-LABEL: 'unsimplified_and1' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 10 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 11 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 12 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 13 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 14 | ; CHECK-NEXT: Predicates: |
| 15 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 16 | ; |
| 17 | entry: |
| 18 | br label %loop |
| 19 | |
| 20 | loop: |
| 21 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 22 | %iv.inc = add nsw i32 %iv, 1 |
| 23 | %becond = icmp ule i32 %iv.inc, %n |
| 24 | %and = and i1 %becond, true |
| 25 | br i1 %and, label %loop, label %leave |
| 26 | |
| 27 | leave: |
| 28 | ret void |
| 29 | } |
| 30 | |
| 31 | define void @unsimplified_and2(i32 %n) { |
| 32 | ; CHECK-LABEL: 'unsimplified_and2' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 33 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and2 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 34 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 35 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 36 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 37 | ; CHECK-NEXT: Predicates: |
| 38 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 39 | ; |
| 40 | entry: |
| 41 | br label %loop |
| 42 | |
| 43 | loop: |
| 44 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 45 | %iv.inc = add nsw i32 %iv, 1 |
| 46 | %becond = icmp ule i32 %iv.inc, %n |
| 47 | %and = and i1 true, %becond |
| 48 | br i1 %and, label %loop, label %leave |
| 49 | |
| 50 | leave: |
| 51 | ret void |
| 52 | } |
| 53 | |
| 54 | define void @unsimplified_and3(i32 %n) { |
| 55 | ; CHECK-LABEL: 'unsimplified_and3' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 56 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and3 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 57 | ; CHECK-NEXT: Loop %loop: backedge-taken count is false |
| 58 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is false |
| 59 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 60 | ; CHECK-NEXT: Predicates: |
| 61 | ; CHECK: Loop %loop: Trip multiple is 1 |
| 62 | ; |
| 63 | entry: |
| 64 | br label %loop |
| 65 | |
| 66 | loop: |
| 67 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 68 | %iv.inc = add nsw i32 %iv, 1 |
| 69 | %becond = icmp ule i32 %iv.inc, %n |
| 70 | %and = and i1 false, %becond |
| 71 | br i1 %and, label %loop, label %leave |
| 72 | |
| 73 | leave: |
| 74 | ret void |
| 75 | } |
| 76 | |
| 77 | define void @unsimplified_and4(i32 %n) { |
| 78 | ; CHECK-LABEL: 'unsimplified_and4' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 79 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_and4 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 80 | ; CHECK-NEXT: Loop %loop: backedge-taken count is false |
| 81 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is false |
| 82 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 83 | ; CHECK-NEXT: Predicates: |
| 84 | ; CHECK: Loop %loop: Trip multiple is 1 |
| 85 | ; |
| 86 | entry: |
| 87 | br label %loop |
| 88 | |
| 89 | loop: |
| 90 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 91 | %iv.inc = add nsw i32 %iv, 1 |
| 92 | %becond = icmp ule i32 %iv.inc, %n |
| 93 | %and = and i1 %becond, false |
| 94 | br i1 %and, label %loop, label %leave |
| 95 | |
| 96 | leave: |
| 97 | ret void |
| 98 | } |
| 99 | |
| 100 | define void @unsimplified_or1(i32 %n) { |
| 101 | ; CHECK-LABEL: 'unsimplified_or1' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 102 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or1 |
| 103 | ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count. |
| 104 | ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count. |
| 105 | ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count. |
| 106 | ; |
| 107 | entry: |
| 108 | br label %loop |
| 109 | |
| 110 | loop: |
| 111 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 112 | %iv.inc = add nsw i32 %iv, 1 |
| 113 | %becond = icmp ule i32 %iv.inc, %n |
| 114 | %or = or i1 %becond, true |
| 115 | br i1 %or, label %loop, label %leave |
| 116 | |
| 117 | leave: |
| 118 | ret void |
| 119 | } |
| 120 | |
| 121 | define void @unsimplified_or2(i32 %n) { |
| 122 | ; CHECK-LABEL: 'unsimplified_or2' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 123 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or2 |
| 124 | ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count. |
| 125 | ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count. |
| 126 | ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count. |
| 127 | ; |
| 128 | entry: |
| 129 | br label %loop |
| 130 | |
| 131 | loop: |
| 132 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 133 | %iv.inc = add nsw i32 %iv, 1 |
| 134 | %becond = icmp ule i32 %iv.inc, %n |
| 135 | %or = or i1 true, %becond |
| 136 | br i1 %or, label %loop, label %leave |
| 137 | |
| 138 | leave: |
| 139 | ret void |
| 140 | } |
| 141 | |
| 142 | define void @unsimplified_or3(i32 %n) { |
| 143 | ; CHECK-LABEL: 'unsimplified_or3' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 144 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or3 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 145 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
| 146 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
| 147 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 148 | ; CHECK-NEXT: Predicates: |
| 149 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 150 | ; |
| 151 | entry: |
| 152 | br label %loop |
| 153 | |
| 154 | loop: |
| 155 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 156 | %iv.inc = add nsw i32 %iv, 1 |
| 157 | %becond = icmp ule i32 %iv.inc, %n |
| 158 | %or = or i1 false, %becond |
| 159 | br i1 %or, label %loop, label %leave |
| 160 | |
| 161 | leave: |
| 162 | ret void |
| 163 | } |
| 164 | |
| 165 | define void @unsimplified_or4(i32 %n) { |
| 166 | ; CHECK-LABEL: 'unsimplified_or4' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 167 | ; CHECK-NEXT: Determining loop execution counts for: @unsimplified_or4 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 168 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
| 169 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
| 170 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 171 | ; CHECK-NEXT: Predicates: |
| 172 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 173 | ; |
| 174 | entry: |
| 175 | br label %loop |
| 176 | |
| 177 | loop: |
| 178 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 179 | %iv.inc = add nsw i32 %iv, 1 |
| 180 | %becond = icmp ule i32 %iv.inc, %n |
| 181 | %or = or i1 %becond, false |
| 182 | br i1 %or, label %loop, label %leave |
| 183 | |
| 184 | leave: |
| 185 | ret void |
| 186 | } |
| 187 | |
| 188 | define void @reversed_and1(i32 %n) { |
| 189 | ; CHECK-LABEL: 'reversed_and1' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 190 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_and1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 191 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
| 192 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
| 193 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 194 | ; CHECK-NEXT: Predicates: |
| 195 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 196 | ; |
| 197 | entry: |
| 198 | br label %loop |
| 199 | |
| 200 | loop: |
| 201 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 202 | %iv.inc = add nsw i32 %iv, 1 |
| 203 | %becond = icmp ugt i32 %iv.inc, %n |
| 204 | %and = and i1 %becond, true |
| 205 | br i1 %and, label %leave, label %loop |
| 206 | |
| 207 | leave: |
| 208 | ret void |
| 209 | } |
| 210 | |
| 211 | define void @reversed_and2(i32 %n) { |
| 212 | ; CHECK-LABEL: 'reversed_and2' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 213 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_and2 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 214 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
| 215 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
| 216 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 217 | ; CHECK-NEXT: Predicates: |
| 218 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 219 | ; |
| 220 | entry: |
| 221 | br label %loop |
| 222 | |
| 223 | loop: |
| 224 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 225 | %iv.inc = add nsw i32 %iv, 1 |
| 226 | %becond = icmp ugt i32 %iv.inc, %n |
| 227 | %and = and i1 true, %becond |
| 228 | br i1 %and, label %leave, label %loop |
| 229 | |
| 230 | leave: |
| 231 | ret void |
| 232 | } |
| 233 | |
| 234 | define void @reversed_and3(i32 %n) { |
| 235 | ; CHECK-LABEL: 'reversed_and3' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 236 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_and3 |
| 237 | ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count. |
| 238 | ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count. |
| 239 | ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count. |
| 240 | ; |
| 241 | entry: |
| 242 | br label %loop |
| 243 | |
| 244 | loop: |
| 245 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 246 | %iv.inc = add nsw i32 %iv, 1 |
| 247 | %becond = icmp ugt i32 %iv.inc, %n |
| 248 | %and = and i1 false, %becond |
| 249 | br i1 %and, label %leave, label %loop |
| 250 | |
| 251 | leave: |
| 252 | ret void |
| 253 | } |
| 254 | |
| 255 | define void @reversed_and4(i32 %n) { |
| 256 | ; CHECK-LABEL: 'reversed_and4' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 257 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_and4 |
| 258 | ; CHECK-NEXT: Loop %loop: Unpredictable backedge-taken count. |
| 259 | ; CHECK-NEXT: Loop %loop: Unpredictable max backedge-taken count. |
| 260 | ; CHECK-NEXT: Loop %loop: Unpredictable predicated backedge-taken count. |
| 261 | ; |
| 262 | entry: |
| 263 | br label %loop |
| 264 | |
| 265 | loop: |
| 266 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 267 | %iv.inc = add nsw i32 %iv, 1 |
| 268 | %becond = icmp ugt i32 %iv.inc, %n |
| 269 | %and = and i1 %becond, false |
| 270 | br i1 %and, label %leave, label %loop |
| 271 | |
| 272 | leave: |
| 273 | ret void |
| 274 | } |
| 275 | |
| 276 | define void @reversed_or1(i32 %n) { |
| 277 | ; CHECK-LABEL: 'reversed_or1' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 278 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_or1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 279 | ; CHECK-NEXT: Loop %loop: backedge-taken count is false |
| 280 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is false |
| 281 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 282 | ; CHECK-NEXT: Predicates: |
| 283 | ; CHECK: Loop %loop: Trip multiple is 1 |
| 284 | ; |
| 285 | entry: |
| 286 | br label %loop |
| 287 | |
| 288 | loop: |
| 289 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 290 | %iv.inc = add nsw i32 %iv, 1 |
| 291 | %becond = icmp ugt i32 %iv.inc, %n |
| 292 | %or = or i1 %becond, true |
| 293 | br i1 %or, label %leave, label %loop |
| 294 | |
| 295 | leave: |
| 296 | ret void |
| 297 | } |
| 298 | |
| 299 | define void @reversed_or2(i32 %n) { |
| 300 | ; CHECK-LABEL: 'reversed_or2' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 301 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_or2 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 302 | ; CHECK-NEXT: Loop %loop: backedge-taken count is false |
| 303 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is false |
| 304 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is false |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 305 | ; CHECK-NEXT: Predicates: |
| 306 | ; CHECK: Loop %loop: Trip multiple is 1 |
| 307 | ; |
| 308 | entry: |
| 309 | br label %loop |
| 310 | |
| 311 | loop: |
| 312 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 313 | %iv.inc = add nsw i32 %iv, 1 |
| 314 | %becond = icmp ugt i32 %iv.inc, %n |
| 315 | %or = or i1 true, %becond |
| 316 | br i1 %or, label %leave, label %loop |
| 317 | |
| 318 | leave: |
| 319 | ret void |
| 320 | } |
| 321 | |
| 322 | define void @reversed_or3(i32 %n) { |
| 323 | ; CHECK-LABEL: 'reversed_or3' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 324 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_or3 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 325 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 326 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 327 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 328 | ; CHECK-NEXT: Predicates: |
| 329 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 330 | ; |
| 331 | entry: |
| 332 | br label %loop |
| 333 | |
| 334 | loop: |
| 335 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 336 | %iv.inc = add nsw i32 %iv, 1 |
| 337 | %becond = icmp ugt i32 %iv.inc, %n |
| 338 | %or = or i1 false, %becond |
| 339 | br i1 %or, label %leave, label %loop |
| 340 | |
| 341 | leave: |
| 342 | ret void |
| 343 | } |
| 344 | |
| 345 | define void @reversed_or4(i32 %n) { |
| 346 | ; CHECK-LABEL: 'reversed_or4' |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 347 | ; CHECK-NEXT: Determining loop execution counts for: @reversed_or4 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 348 | ; CHECK-NEXT: Loop %loop: backedge-taken count is %n |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 349 | ; CHECK-NEXT: Loop %loop: max backedge-taken count is -1 |
Philip Reames | f1a9a83 | 2019-11-21 09:52:38 -0800 | [diff] [blame] | 350 | ; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is %n |
| 351 | ; CHECK-NEXT: Predicates: |
| 352 | ; CHECK: Loop %loop: Trip multiple is 1 |
Philip Reames | 3a8104a | 2019-11-19 11:48:51 -0800 | [diff] [blame] | 353 | ; |
| 354 | entry: |
| 355 | br label %loop |
| 356 | |
| 357 | loop: |
| 358 | %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ] |
| 359 | %iv.inc = add nsw i32 %iv, 1 |
| 360 | %becond = icmp ugt i32 %iv.inc, %n |
| 361 | %or = or i1 %becond, false |
| 362 | br i1 %or, label %leave, label %loop |
| 363 | |
| 364 | leave: |
| 365 | ret void |
| 366 | } |