This is an archive of the discontinued LLVM Phabricator instance.

[Statepoints] Reuse stack slots more than once within a basic block
ClosedPublic

Authored by reames on Oct 4 2016, 9:45 AM.

Details

Summary

The stack slot reuse code had a really amusing bug. We ended up only reusing a stack slot exact once (initial use + reuse) within a basic block. If we had a third statepoint to process, we ended up allocating a new set of stack slots. If we crossed a basic block boundary, the set got cleared. As a result, code which is invoke heavy doesn't see the problem, but multiple calls within a basic block does. Net result: as we optimize invokes into calls, lowering gets worse.

The root error here is that the bitmap uses by the custom allocator wasn't kept in sync. The result was that we ended up resizing the bitmap on the next statepoint (to handle the cross block case), reset the bit once, but then never reset it again.

Diff Detail

Repository
rL LLVM

Event Timeline

reames updated this revision to Diff 73498.Oct 4 2016, 9:45 AM
reames retitled this revision from to [Statepoints] Reuse stack slots more than once within a basic block.
reames updated this object.
reames added reviewers: igor-laevsky, sanjoy.
reames added a subscriber: llvm-commits.
igor-laevsky accepted this revision.Oct 5 2016, 5:47 AM
igor-laevsky edited edge metadata.

looks good

This revision is now accepted and ready to land.Oct 5 2016, 5:47 AM
This revision was automatically updated to reflect the committed changes.