allow -1 strides to reuse "1" strides.
authorChris Lattner <sabre@nondot.org>
Mon, 2 Apr 2007 22:51:58 +0000 (22:51 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 2 Apr 2007 22:51:58 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35607 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 744e0548bad0480870bdf9b6890d7684bd957532..db8ab485e394c428ae1b60e83ab27864e3f17893 100644 (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