diff options
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index c436cec26e..a6795a72ef 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; |