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
This commit is contained in:
Dan Gohman
2009-04-27 20:35:32 +00:00
parent 487fa01673
commit c7749b747e
3 changed files with 166 additions and 1 deletions

View File

@@ -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;