[PATCH] D53485: [ScheduleDAGRRList] Do not preschedule the node has ADJCALLSTACKDOWN
Shiva Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 22 20:16:39 PDT 2018
shiva0217 updated this revision to Diff 170562.
shiva0217 added a comment.
Update patch to address Tim's comments.
Repository:
rL LLVM
https://reviews.llvm.org/D53485
Files:
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Index: lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -2939,6 +2939,29 @@
(cast<RegisterSDNode>(N->getOperand(1))->getReg()))
continue;
+ SDNode *PredFrameSetup = nullptr;
+ for (const SDep &Pred : SU.Preds)
+ if (Pred.isCtrl() && Pred.getSUnit()) {
+ // Find the predecessor which is not data dependence.
+ SDNode *PredND = Pred.getSUnit()->getNode();
+
+ // If PredND is FrameSetup, we should not pre-scheduled the node,
+ // or else, when bottom up scheduling, ADJCALLSTACKDOWN and
+ // ADJCALLSTACKUP may hold CallResource too long and make other
+ // calls can't be scheduled. If there's no other available node
+ // to schedule, the schedular will try to rename the register by
+ // creating copy to avoid the conflict which will fail because
+ // CallResource is not a real physical register.
+ if (PredND && PredND->isMachineOpcode() &&
+ (PredND->getMachineOpcode() == TII->getCallFrameSetupOpcode())) {
+ PredFrameSetup = PredND;
+ break;
+ }
+ }
+ // Skip the node has FrameSetup parent.
+ if (PredFrameSetup != nullptr)
+ continue;
+
// Locate the single data predecessor.
SUnit *PredSU = nullptr;
for (const SDep &Pred : SU.Preds)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53485.170562.patch
Type: text/x-patch
Size: 1489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/bdb71fd0/attachment.bin>
More information about the llvm-commits
mailing list