diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2017-10-04 06:53:22 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-10-04 06:53:22 +0000 |
commit | 8aacef6cae0e57040b4957fc81e014dab5b7edae (patch) | |
tree | 5293b622d304c63098feb2cc836b721dc68f9cba /llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | |
parent | 75b1992f78625c7c67219aa9b41a267580c07aab (diff) | |
download | bcm5719-llvm-8aacef6cae0e57040b4957fc81e014dab5b7edae.tar.gz bcm5719-llvm-8aacef6cae0e57040b4957fc81e014dab5b7edae.zip |
[IRCE] Temporarily disable unsigned latch conditions by default
We have found some corner cases connected to range intersection where IRCE makes
a bad thing when the latch condition is unsigned. The fix for that will go as a follow up.
This patch temporarily disables IRCE for unsigned latch conditions until the issue is fixed.
The unsigned latch conditions were introduced to IRCE by rL310027.
Differential Revision: https://reviews.llvm.org/D38529
llvm-svn: 314881
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index ce318f7d1de..cc0f2c5bb48 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -79,6 +79,9 @@ static cl::opt<int> MaxExitProbReciprocal("irce-max-exit-prob-reciprocal", static cl::opt<bool> SkipProfitabilityChecks("irce-skip-profitability-checks", cl::Hidden, cl::init(false)); +static cl::opt<bool> AllowUnsignedLatchCondition("irce-allow-unsigned-latch", + cl::Hidden, cl::init(false)); + static const char *ClonedLoopTag = "irce.loop.clone"; #define DEBUG_TYPE "irce" @@ -889,6 +892,15 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, IsSignedPredicate = Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGT; + + // FIXME: We temporarily disable unsigned latch conditions by default + // because of found problems with intersecting signed and unsigned ranges. + // We are going to turn it on once the problems are fixed. + if (!IsSignedPredicate && !AllowUnsignedLatchCondition) { + FailureReason = "unsigned latch conditions are explicitly prohibited"; + return None; + } + // The predicate that we need to check that the induction variable lies // within bounds. ICmpInst::Predicate BoundPred = @@ -964,6 +976,15 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, IsSignedPredicate = Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGT; + + // FIXME: We temporarily disable unsigned latch conditions by default + // because of found problems with intersecting signed and unsigned ranges. + // We are going to turn it on once the problems are fixed. + if (!IsSignedPredicate && !AllowUnsignedLatchCondition) { + FailureReason = "unsigned latch conditions are explicitly prohibited"; + return None; + } + // The predicate that we need to check that the induction variable lies // within bounds. ICmpInst::Predicate BoundPred = |