OSDN Git Service

[StatepointLowering] Fix a mistake in rL261336
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 19 Feb 2016 18:15:53 +0000 (18:15 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 19 Feb 2016 18:15:53 +0000 (18:15 +0000)
The check on MFI->getObjectSize() has to be on the FrameIndex, not on
the index of the FrameIndex in AllocatedStackSlots.  Weirdly, the tests
I added in rL261336 didn't catch this.

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

lib/CodeGen/SelectionDAG/StatepointLowering.cpp

index 0116fdd..37f74cb 100644 (file)
@@ -88,11 +88,12 @@ StatepointLoweringState::allocateStackSlot(EVT ValueType,
          "Broken invariant");
 
   for (; NextSlotToAllocate < NumSlots; NextSlotToAllocate++) {
-    if (!AllocatedStackSlots.test(NextSlotToAllocate) &&
-        MFI->getObjectSize(NextSlotToAllocate) == SpillSize) {
+    if (!AllocatedStackSlots.test(NextSlotToAllocate)) {
       const int FI = Builder.FuncInfo.StatepointStackSlots[NextSlotToAllocate];
-      AllocatedStackSlots.set(NextSlotToAllocate);
-      return Builder.DAG.getFrameIndex(FI, ValueType);
+      if (MFI->getObjectSize(FI) == SpillSize) {
+        AllocatedStackSlots.set(NextSlotToAllocate);
+        return Builder.DAG.getFrameIndex(FI, ValueType);
+      }
     }
   }