[SCEV] Check whether the start is non-zero in `ScalarEvolution::howFa… · llvm/llvm-project@2cc5362 (original) (raw)
`@@ -329,10 +329,9 @@ define void @ne_nsw_nonneg_step(ptr nocapture %A, i32 %n, i32 %s) mustprogress {
`
329
329
`;
`
330
330
`; CHECK-LABEL: 'ne_nsw_nonneg_step'
`
331
331
`; CHECK-NEXT: Determining loop execution counts for: @ne_nsw_nonneg_step
`
332
``
`-
; CHECK-NEXT: Loop %for.body: backedge-taken count is (((-1 * %s) + %n) /u %s)
`
333
``
`-
; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is i32 -1
`
334
``
`-
; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (((-1 * %s) + %n) /u %s)
`
335
``
`-
; CHECK-NEXT: Loop %for.body: Trip multiple is 1
`
``
332
`+
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
`
``
333
`+
; CHECK-NEXT: Loop %for.body: Unpredictable constant max backedge-taken count.
`
``
334
`+
; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count.
`
336
335
`;
`
337
336
`entry:
`
338
337
`%nonneg_step = icmp sge i32 %s, 0
`
`@@ -442,10 +441,9 @@ define void @ne_nuw_nonneg_step(ptr nocapture %A, i32 %n, i32 %s) mustprogress {
`
442
441
`;
`
443
442
`; CHECK-LABEL: 'ne_nuw_nonneg_step'
`
444
443
`; CHECK-NEXT: Determining loop execution counts for: @ne_nuw_nonneg_step
`
445
``
`-
; CHECK-NEXT: Loop %for.body: backedge-taken count is (((-1 * %s) + %n) /u %s)
`
446
``
`-
; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is i32 -1
`
447
``
`-
; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (((-1 * %s) + %n) /u %s)
`
448
``
`-
; CHECK-NEXT: Loop %for.body: Trip multiple is 1
`
``
444
`+
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
`
``
445
`+
; CHECK-NEXT: Loop %for.body: Unpredictable constant max backedge-taken count.
`
``
446
`+
; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count.
`
449
447
`;
`
450
448
`entry:
`
451
449
`%nonneg_step = icmp sge i32 %s, 0
`
`@@ -493,6 +491,26 @@ for.end: ; preds = %for.body, %entry
`
493
491
`ret void
`
494
492
`}
`
495
493
``
``
494
`+
define i32 @pr131465(i1 %x) mustprogress {
`
``
495
`+
; CHECK-LABEL: 'pr131465'
`
``
496
`+
; CHECK-NEXT: Determining loop execution counts for: @pr131465
`
``
497
`+
; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
`
``
498
`+
; CHECK-NEXT: Loop %for.body: Unpredictable constant max backedge-taken count.
`
``
499
`+
; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count.
`
``
500
`+
;
`
``
501
`+
entry:
`
``
502
`+
%inc = zext i1 %x to i32
`
``
503
`+
br label %for.body
`
``
504
+
``
505
`+
for.body:
`
``
506
`+
%indvar = phi i32 [ 2, %entry ], [ %next, %for.body ]
`
``
507
`+
%next = add nsw i32 %indvar, %inc
`
``
508
`+
%exitcond = icmp eq i32 %next, 2
`
``
509
`+
br i1 %exitcond, label %for.end, label %for.body
`
``
510
+
``
511
`+
for.end:
`
``
512
`+
ret i32 0
`
``
513
`+
}
`
496
514
``
497
515
`declare void @llvm.assume(i1)
`
498
516
``