When merging one use into another, transfer the offsets from
authorDan Gohman <gohman@apple.com>
Thu, 7 Oct 2010 23:36:45 +0000 (23:36 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 7 Oct 2010 23:36:45 +0000 (23:36 +0000)
the old use to the new one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116008 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopStrengthReduce.cpp

index 07477661f9aa7e14c25b22f482d281a252f0f3ce..f54bf63de225c98f8c8d42e5e936ff538623b24d 100644 (file)
@@ -3035,6 +3035,14 @@ void LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode() {
                 if (Fixup.LUIdx == LUIdx) {
                   Fixup.LUIdx = LUThatHas - &Uses.front();
                   Fixup.Offset += F.AM.BaseOffs;
+                  // Add the new offset to LUThatHas' offset list.
+                  if (LUThatHas->Offsets.back() != Fixup.Offset) {
+                    LUThatHas->Offsets.push_back(Fixup.Offset);
+                    if (Fixup.Offset > LUThatHas->MaxOffset)
+                      LUThatHas->MaxOffset = Fixup.Offset;
+                    if (Fixup.Offset < LUThatHas->MinOffset)
+                      LUThatHas->MinOffset = Fixup.Offset;
+                  }
                   DEBUG(dbgs() << "New fixup has offset "
                                << Fixup.Offset << '\n');
                 }