allow -1 strides to reuse "1" strides.

llvm-svn: 35607
This commit is contained in:
Chris Lattner 2007-04-02 22:51:58 +00:00
parent 03edb8b08e
commit 3df2382275

View File

@ -929,7 +929,8 @@ unsigned LoopStrengthReduce::CheckForIVReuse(const SCEVHandle &Stride,
for (std::map<SCEVHandle, IVsOfOneStride>::iterator SI= IVsByStride.begin(),
SE = IVsByStride.end(); SI != SE; ++SI) {
int64_t SSInt = cast<SCEVConstant>(SI->first)->getValue()->getSExtValue();
if (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)
if (SInt != -SSInt &&
(unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0))
continue;
int64_t Scale = SInt / SSInt;
// Check that this stride is valid for all the types used for loads and