summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2017-10-19 05:33:28 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2017-10-19 05:33:28 +0000
commit3612d4b4f9df25d11b8ab64109ea5450eef2439a (patch)
tree4a008124d17b6fa02ba4cc4a9f136f107590c88a /llvm
parenta99ecf1bbb554df19b68805d2df8caa80ae0818d (diff)
downloadbcm5719-llvm-3612d4b4f9df25d11b8ab64109ea5450eef2439a.tar.gz
bcm5719-llvm-3612d4b4f9df25d11b8ab64109ea5450eef2439a.zip
[NFC][IRCE] Filter out empty ranges early
llvm-svn: 316146
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index 9cdc1d18963..111713b541c 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -1655,12 +1655,14 @@ static Optional<InductiveRangeCheck::Range>
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.
OpenPOWER on IntegriCloud