From f6fee29ceb7477ab42a233480c866dc90d7b12f6 Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Fri, 19 Feb 2016 18:15:56 +0000 Subject: [PATCH] [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(). llvm-svn: 261348 --- llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp index 37f74cb9d700..1e9d0ef794cd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp @@ -99,14 +99,15 @@ StatepointLoweringState::allocateStackSlot(EVT ValueType, // Couldn't find a free slot, so create a new one: - StatepointMaxSlotsRequired = - std::max(StatepointMaxSlotsRequired, NumSlots + 1); - SDValue SpillSlot = Builder.DAG.CreateStackTemporary(ValueType); const unsigned FI = cast(SpillSlot)->getIndex(); MFI->markAsStatepointSpillSlotObjectIndex(FI); Builder.FuncInfo.StatepointStackSlots.push_back(FI); + + StatepointMaxSlotsRequired = std::max( + StatepointMaxSlotsRequired, Builder.FuncInfo.StatepointStackSlots.size()); + return SpillSlot; } -- 2.34.1