aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-27 20:35:32 +0000
committerDan Gohman <gohman@apple.com>2009-04-27 20:35:32 +0000
commitc7749b747e634f310b7f0e075f7329dcb88f58cc (patch)
treec49c4223ff0145c11e8d9e5ca5747bfc5a03bc46 /lib
parent487fa01673a1d13331b7173e9e6812e72dd4361e (diff)
downloadexternal_llvm-c7749b747e634f310b7f0e075f7329dcb88f58cc.zip
external_llvm-c7749b747e634f310b7f0e075f7329dcb88f58cc.tar.gz
external_llvm-c7749b747e634f310b7f0e075f7329dcb88f58cc.tar.bz2
Permit ChangeCompareStride to rewrite a comparison when the factor
between the comparison's iv stride and the candidate stride is exactly -1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index c436cec..a6795a7 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2028,7 +2028,9 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond,
if (!isa<SCEVConstant>(SI->first))
continue;
int64_t SSInt = cast<SCEVConstant>(SI->first)->getValue()->getSExtValue();
- if (abs(SSInt) <= abs(CmpSSInt) || (SSInt % CmpSSInt) != 0)
+ if (SSInt == CmpSSInt ||
+ abs(SSInt) < abs(CmpSSInt) ||
+ (SSInt % CmpSSInt) != 0)
continue;
Scale = SSInt / CmpSSInt;