[llvm] r316146 - [NFC][IRCE] Filter out empty ranges early
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 22:33:28 PDT 2017
Author: mkazantsev
Date: Wed Oct 18 22:33:28 2017
New Revision: 316146
URL: http://llvm.org/viewvc/llvm-project?rev=316146&view=rev
Log:
[NFC][IRCE] Filter out empty ranges early
Modified:
llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp?rev=316146&r1=316145&r2=316146&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp Wed Oct 18 22:33:28 2017
@@ -1655,12 +1655,14 @@ static Optional<InductiveRangeCheck::Ran
IntersectRange(ScalarEvolution &SE,
const Optional<InductiveRangeCheck::Range> &R1,
const InductiveRangeCheck::Range &R2) {
- if (!R1.hasValue()) {
- if (!R2.isEmpty())
- return R2;
+ if (R2.isEmpty())
return None;
- }
+ if (!R1.hasValue())
+ return R2;
auto &R1Value = R1.getValue();
+ // We never return empty ranges from this function, and R1 is supposed to be
+ // a result of intersection. Thus, R1 is never empty.
+ assert(!R1Value.isEmpty() && "We should never have empty R1!");
// TODO: we could widen the smaller range and have this work; but for now we
// bail out to keep things simple.
More information about the llvm-commits
mailing list