Improve pre-RA-sched register pressure tracking for duplicate operands.
authorAndrew Trick <atrick@apple.com>
Wed, 9 Mar 2011 19:12:43 +0000 (19:12 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 9 Mar 2011 19:12:43 +0000 (19:12 +0000)
This helps cases like 2008-07-19-movups-spills.ll, but doesn't have an obvious impact on benchmarks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127347 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp

index b762af5ca9b22da71838656df0f31a06e4cc6b6a..202f7ab4e14f3e72054ab100fb92bc4f4f255c98 100644 (file)
@@ -419,11 +419,15 @@ void ScheduleDAGSDNodes::AddSchedEdges() {
           ST.adjustSchedDependency(OpSU, SU, const_cast<SDep &>(dep));
         }
 
-        if (!SU->addPred(dep) && !dep.isCtrl() && OpSU->NumRegDefsLeft > 0) {
+        if (!SU->addPred(dep) && !dep.isCtrl() && OpSU->NumRegDefsLeft > 1) {
           // Multiple register uses are combined in the same SUnit. For example,
           // we could have a set of glued nodes with all their defs consumed by
           // another set of glued nodes. Register pressure tracking sees this as
           // a single use, so to keep pressure balanced we reduce the defs.
+          //
+          // We can't tell (without more book-keeping) if this results from
+          // glued nodes or duplicate operands. As long as we don't reduce
+          // NumRegDefsLeft to zero, we handle the common cases well.
           --OpSU->NumRegDefsLeft;
         }
       }