[PATCH] D31536: [SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 31 08:45:16 PDT 2017


samparker created this revision.
Herald added a subscriber: MatzeB.

This is an alternative patch for https://reviews.llvm.org/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.


https://reviews.llvm.org/D31536

Files:
  lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp


Index: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1305,7 +1305,8 @@
     // If we're in the middle of scheduling a call, don't begin scheduling
     // another call. Also, don't allow any physical registers to be live across
     // the call.
-    if (Node->getMachineOpcode() == (unsigned)TII->getCallFrameDestroyOpcode()) {
+    if (Node->getMachineOpcode() == TII->getCallFrameDestroyOpcode() || {
+        Node->getMachineOpcode() == TII->getCallFrameSetupOpcode()) {
       // Check the special calling-sequence resource.
       unsigned CallResource = TRI->getNumRegs();
       if (LiveRegDefs[CallResource]) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31536.93645.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170331/49aae8d8/attachment.bin>


More information about the llvm-commits mailing list