[PATCH] D105941: [ScalarEvolution] Make isKnownNonZero handle more cases.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 13 15:37:19 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb8c7a980fe4: [ScalarEvolution] Make isKnownNonZero handle more cases. (authored by efriedma).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105941/new/
https://reviews.llvm.org/D105941
Files:
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/trip-count9.ll
Index: llvm/test/Analysis/ScalarEvolution/trip-count9.ll
===================================================================
--- llvm/test/Analysis/ScalarEvolution/trip-count9.ll
+++ llvm/test/Analysis/ScalarEvolution/trip-count9.ll
@@ -311,9 +311,9 @@
define void @even_start1(i4 %n) {
; CHECK-LABEL: 'even_start1'
; CHECK-NEXT: Determining loop execution counts for: @even_start1
-; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 * %n))
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 * %n))
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -333,9 +333,9 @@
define void @even_start1_step2(i4 %n) {
; CHECK-LABEL: 'even_start1_step2'
; CHECK-NEXT: Determining loop execution counts for: @even_start1_step2
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n)))<nsw> /u 2)
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (2 * %n)) /u 2)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax (2 * %n)))<nsw> /u 2)
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (2 * %n)) /u 2)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -443,9 +443,9 @@
define void @even_nsw_start1(i4 %n) {
; CHECK-LABEL: 'even_nsw_start1'
; CHECK-NEXT: Determining loop execution counts for: @even_nsw_start1
-; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: backedge-taken count is (-2 + (2 * %n))
; CHECK-NEXT: Loop %loop: max backedge-taken count is 4
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 smax (2 * %n)))<nsw>
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is (-2 + (2 * %n))
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
@@ -465,9 +465,9 @@
define void @even_nsw_start1_step2(i4 %n) {
; CHECK-LABEL: 'even_nsw_start1_step2'
; CHECK-NEXT: Determining loop execution counts for: @even_nsw_start1_step2
-; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (3 smax (2 * %n)))<nsw> /u 2)
+; CHECK-NEXT: Loop %loop: backedge-taken count is ((-2 + (2 * %n)) /u 2)
; CHECK-NEXT: Loop %loop: max backedge-taken count is 2
-; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (3 smax (2 * %n)))<nsw> /u 2)
+; CHECK-NEXT: Loop %loop: Predicated backedge-taken count is ((-2 + (2 * %n)) /u 2)
; CHECK-NEXT: Predicates:
; CHECK: Loop %loop: Trip multiple is 1
;
Index: llvm/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolution.cpp
+++ llvm/lib/Analysis/ScalarEvolution.cpp
@@ -9822,7 +9822,7 @@
}
bool ScalarEvolution::isKnownNonZero(const SCEV *S) {
- return isKnownNegative(S) || isKnownPositive(S);
+ return getUnsignedRangeMin(S) != 0;
}
std::pair<const SCEV *, const SCEV *>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105941.358449.patch
Type: text/x-patch
Size: 3211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210713/d5807691/attachment.bin>
More information about the llvm-commits
mailing list