[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

Evan Cheng evan.cheng at apple.com
Wed Nov 1 14:39:44 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

ScheduleDAGRRList.cpp updated: 1.16 -> 1.17
---
Log message:

Clean up.

---
Diffs of the changes:  (+11 -5)

 ScheduleDAGRRList.cpp |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.16 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.17
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.16	Wed Nov  1 16:17:06 2006
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp	Wed Nov  1 16:39:30 2006
@@ -719,7 +719,14 @@
     return SethiUllmanNumber;
 
   unsigned Opc = SU->Node->getOpcode();
-  if (Opc == ISD::TokenFactor || Opc == ISD::CopyToReg)
+  if (Opc == ISD::CopyFromReg && !isCopyFromLiveIn(SU))
+    // CopyFromReg should be close to its def because it restricts allocation
+    // choices. But if it is a livein then perhaps we want it closer to the
+    // uses so it can be coalesced.
+    SethiUllmanNumber = INT_MIN + 10;
+  else if (Opc == ISD::TokenFactor || Opc == ISD::CopyToReg)
+    // CopyToReg should be close to its uses to facilitate coalescing and avoid
+    // spilling.
     SethiUllmanNumber = INT_MAX - 10;
   else if (SU->NumSuccsLeft == 0)
     // If SU does not have a use, i.e. it doesn't produce a value that would
@@ -727,10 +734,9 @@
     // Give it a small SethiUllman number so it will be scheduled right before its
     // predecessors that it doesn't lengthen their live ranges.
     SethiUllmanNumber = INT_MIN + 10;
-  // FIXME: remove this else if? It seems to reduce register spills but often
-  // ends up increasing runtime. Need to investigate.
-  else if (SU->NumPredsLeft == 0 &&
-           (Opc != ISD::CopyFromReg || isCopyFromLiveIn(SU)))
+  else if (SU->NumPredsLeft == 0)
+    // If SU does not have a def, schedule it close to its uses because it does
+    // not lengthen any live ranges.
     SethiUllmanNumber = INT_MAX - 10;
   else {
     int Extra = 0;






More information about the llvm-commits mailing list