Make sure we correctly set LiveRegGens when a call is unscheduled. <rdar://problem...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 7 Dec 2011 22:24:28 +0000 (22:24 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 7 Dec 2011 22:24:28 +0000 (22:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146087 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

index 98931289ce25693447fdf94f8d0d4f0a020c395f..80162d7015c7ac06e35172220c1177a521495ff0 100644 (file)
@@ -146,6 +146,10 @@ private:
   /// and similar queries.
   ScheduleDAGTopologicalSort Topo;
 
+  // Hack to keep track of the inverse of FindCallSeqStart without more crazy
+  // DAG crawling.
+  DenseMap<SUnit*, SUnit*> CallSeqEndForStart;
+
 public:
   ScheduleDAGRRList(MachineFunction &mf, bool needlatency,
                     SchedulingPriorityQueue *availqueue,
@@ -306,6 +310,7 @@ void ScheduleDAGRRList::Schedule() {
   // to track the virtual resource of a calling sequence.
   LiveRegDefs.resize(TRI->getNumRegs() + 1, NULL);
   LiveRegGens.resize(TRI->getNumRegs() + 1, NULL);
+  CallSeqEndForStart.clear();
 
   // Build the scheduling graph.
   BuildSchedGraph(NULL);
@@ -524,6 +529,8 @@ void ScheduleDAGRRList::ReleasePredecessors(SUnit *SU) {
         SDNode *N = FindCallSeqStart(Node, NestLevel, MaxNest, TII);
 
         SUnit *Def = &SUnits[N->getNodeId()];
+        CallSeqEndForStart[Def] = SU;
+
         ++NumLiveRegs;
         LiveRegDefs[CallResource] = Def;
         LiveRegGens[CallResource] = SU;
@@ -790,7 +797,7 @@ void ScheduleDAGRRList::UnscheduleNodeBottomUp(SUnit *SU) {
         SUNode->getMachineOpcode() == (unsigned)TII->getCallFrameSetupOpcode()) {
       ++NumLiveRegs;
       LiveRegDefs[CallResource] = SU;
-      LiveRegGens[CallResource] = NULL;
+      LiveRegGens[CallResource] = CallSeqEndForStart[SU];
     }
   }