This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs
ClosedPublic

Authored by samparker on Mar 31 2017, 8:45 AM.

Details

Summary

This is an alternative patch for D29492, the bug was originally reported in https://bugs.llvm.org/show_bug.cgi?id=30911.

The issue arises when multiple CALLSEQ_BEGIN nodes are unscheduled as the last node to be unscheduled will gain access to the CallResource register. But when a node is being picked, only CALLSEQ_END nodes are checked against the CallResource and have their chains evaluated. This then means that other CALLSEQ_BEGIN nodes can be scheduled before the existing call sequence has been finalised. This patch adds a check against the FrameSetup nodes in DelayForLiveRegs to prevent this from happening.

Diff Detail

Event Timeline

samparker created this revision.Mar 31 2017, 8:45 AM

Thanks Sam, you are fast! This patch fixes the crash for me and all test cases still pass. Very nice!

I am not an expert in this area, so I will let others review the patch. Thanks again for helping make the AOSP buildbot green!

lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
1309

There seems to be something wrong with the opening braces here. I had to fix them before this compiled.

atrick edited edge metadata.Mar 31 2017, 10:11 AM

I don't remember (or never understood) how all this code works. But the fix looks reasonable.

MatzeB edited edge metadata.Apr 4 2017, 10:48 AM

This needs a test!

samparker updated this revision to Diff 94661.Apr 10 2017, 5:01 AM

Added the test already provided in D29492. Also fixed the typo.

grosser accepted this revision.Apr 10 2017, 11:32 AM

Very nice. I think this is good to go.

This revision is now accepted and ready to land.Apr 10 2017, 11:32 AM
This revision was automatically updated to reflect the committed changes.