OSDN Git Service

[StatepointLowering] Fix bug in allocateStackSlot
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 19 Feb 2016 17:15:22 +0000 (17:15 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 19 Feb 2016 17:15:22 +0000 (17:15 +0000)
commitfffaef16a2047af4b3967f624f663b4e8c7cf4f7
tree54f05b6187cad3594bf02bf78ad555b19039e80d
parentf08995153ba496e110029f65e85458a3868fa47e
[StatepointLowering] Fix bug in allocateStackSlot

allocateStackSlot did not consider the size of the value to be spilled
before deciding to re-use a spill slot.  This was originally okay (since
originally we'd only ever spill pointers), but it became not okay when
we changed our scheme to directly spill vectors of pointers.

While this change fixes the bug pointed out, it has two performance
caveats:

 - It matches spill slot and spillee size exactly, while in theory we
   can spill, e.g., an 8 byte pointer into a 16 byte slot.  This is
   slightly complicated to fix since in the stackmaps section, we report
   the size of the spill slot as the size of the "indirect value"; and
   if they're no longer equivalent, we'll have to keep track of the
   (indirect) value size separately from the stack slot size.

 - It will "spuriously run out" of reusable slots, since we now have an
   second check in the search loop in addition to the availablity
   check (e.g. you had two free scalar slots, and you first ask for a
   vector slot followed by a scalar slot).  I'll fix this in a later
   commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261336 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/StatepointLowering.cpp
test/CodeGen/X86/statepoint-vector-bad-spill.ll [new file with mode: 0644]