diff options
author | Max Kazantsev <max.kazantsev@azul.com> | 2017-11-01 13:21:56 +0000 |
---|---|---|
committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-11-01 13:21:56 +0000 |
commit | 6f5229d7da594d63ee954346e06d3e508f9ee07a (patch) | |
tree | 0fc8d0d7bf7f5bbd6bf3266cf0c70ee81a987ee5 /llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | |
parent | 687982c181912ce7970fe526ae0e8dd5a9b4d28a (diff) | |
download | bcm5719-llvm-6f5229d7da594d63ee954346e06d3e508f9ee07a.tar.gz bcm5719-llvm-6f5229d7da594d63ee954346e06d3e508f9ee07a.zip |
Revert rL311205 "[IRCE] Fix buggy behavior in Clamp"
This patch reverts rL311205 that was initially a wrong fix. The real problem
was in intersection of signed and unsigned ranges (see rL316552), and the
patch being reverted masked the problem instead of fixing it.
By now, the test against which rL311205 was made works OK even without this
code. This revert patch also contains a test case that demonstrates incorrect
behavior caused by rL311205: it is caused by incorrect choise of signed max
instead of unsigned.
llvm-svn: 317088
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index d7361c03f02..01f7a969ba9 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -1132,8 +1132,7 @@ LoopConstrainer::calculateSubRanges(bool IsSignedPredicate) const { } auto Clamp = [this, Smallest, Greatest, IsSignedPredicate](const SCEV *S) { - bool MaybeNegativeValues = IsSignedPredicate || !SE.isKnownNonNegative(S); - return MaybeNegativeValues + return IsSignedPredicate ? SE.getSMaxExpr(Smallest, SE.getSMinExpr(Greatest, S)) : SE.getUMaxExpr(Smallest, SE.getUMinExpr(Greatest, S)); }; |