This is an archive of the discontinued LLVM Phabricator instance.

[Statepoint] Always spill base pointer.
ClosedPublic

Authored by dantrushin on Aug 27 2020, 7:17 AM.

Details

Summary

There is a subtle problem with new statepoint lowering scheme
when base and pointers are the same (see PR46917 for more context):

%1 = STATEPOINT ... %0, %0(tied-def 0)...

if, for some reason, register allocator desides to put two instances
of %0 into two different objects (registers or spill slots), we may
end up with

$reg3 = STATEPOINT ... $reg2, $reg1(tied-def 0)...

and nothing will prevent later passes to sink uses of $reg2 below
statepoint, which is incorrect.

As a short term solution, always put base pointers on stack during
lowering.
A longer term solution may be to rework MIR statepoint format to
avoid GC pointer duplication in statepoint argument list.

Diff Detail

Event Timeline

dantrushin created this revision.Aug 27 2020, 7:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 27 2020, 7:17 AM
dantrushin requested review of this revision.Aug 27 2020, 7:17 AM
reames accepted this revision.Aug 27 2020, 5:30 PM

LGTM

This revision is now accepted and ready to land.Aug 27 2020, 5:30 PM
This revision was automatically updated to reflect the committed changes.