diff options
author | Dan Gohman <gohman@apple.com> | 2009-04-27 20:35:32 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-04-27 20:35:32 +0000 |
commit | e99f98262c5c766ec832b756aa303a3cdcc01bd7 (patch) | |
tree | 8c470e22cfc760b6d0b7f3befc3d6c265daf9071 /llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 41f2477a500e4605576d5e9d514112e8662c4c88 (diff) | |
download | bcm5719-llvm-e99f98262c5c766ec832b756aa303a3cdcc01bd7.tar.gz bcm5719-llvm-e99f98262c5c766ec832b756aa303a3cdcc01bd7.zip |
Permit ChangeCompareStride to rewrite a comparison when the factor
between the comparison's iv stride and the candidate stride is
exactly -1.
llvm-svn: 70244
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index c436cec26ed..a6795a72ef9 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/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; |