[llvm] r261348 - [StatepointLowering] Update StatepointMaxSlotsRequired correctly

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 19 10:15:56 PST 2016


Author: sanjoy
Date: Fri Feb 19 12:15:56 2016
New Revision: 261348

URL: http://llvm.org/viewvc/llvm-project?rev=261348&view=rev
Log:
[StatepointLowering] Update StatepointMaxSlotsRequired correctly

Now that we don't always add an element to AllocatedStackSlots if we
don't find a pre-existing unallocated stack slot, bumping
StatepointMaxSlotsRequired to `NumSlots + 1` is not correct.  Instead
bump the statistic near the push_back, to
Builder.FuncInfo.StatepointStackSlots.size().

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp?rev=261348&r1=261347&r2=261348&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/StatepointLowering.cpp Fri Feb 19 12:15:56 2016
@@ -99,14 +99,15 @@ StatepointLoweringState::allocateStackSl
 
   // Couldn't find a free slot, so create a new one:
 
-  StatepointMaxSlotsRequired =
-       std::max<unsigned long>(StatepointMaxSlotsRequired, NumSlots + 1);
-
   SDValue SpillSlot = Builder.DAG.CreateStackTemporary(ValueType);
   const unsigned FI = cast<FrameIndexSDNode>(SpillSlot)->getIndex();
   MFI->markAsStatepointSpillSlotObjectIndex(FI);
 
   Builder.FuncInfo.StatepointStackSlots.push_back(FI);
+
+  StatepointMaxSlotsRequired = std::max<unsigned long>(
+      StatepointMaxSlotsRequired, Builder.FuncInfo.StatepointStackSlots.size());
+
   return SpillSlot;
 }
 




More information about the llvm-commits mailing list