[PATCH] D38581: [IRCE] Fix intersection between signed and unsigned ranges

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 07:38:37 PDT 2017


anna added inline comments.


================
Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:900
-    // We are going to turn it on once the problems are fixed.
-    if (!IsSignedPredicate && !AllowUnsignedLatchCondition) {
-      FailureReason = "unsigned latch conditions are explicitly prohibited";
----------------
How about leaving this here to quickly find any problems in the future? 


================
Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:984
-    // We are going to turn it on once the problems are fixed.
-    if (!IsSignedPredicate && !AllowUnsignedLatchCondition) {
-      FailureReason = "unsigned latch conditions are explicitly prohibited";
----------------
Ditto here.


================
Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:1753
+  auto RangeIsNonNegative = [&](InductiveRangeCheck::Range &R) {
+    return SE.isKnownNonNegative(R.getBegin()) &&
+           SE.isKnownNonNegative(R.getEnd());
----------------
Is this enough for proving range is non-negative?

Looking at this lambda alone with no context here, we can have [5, 2] and still have range wrap around.
Is there a way to add an assert that getBegin < getEnd?


https://reviews.llvm.org/D38581





More information about the llvm-commits mailing list