Don't set SUnit::hasPhysRegDefs to true unless the defs are
authorDan Gohman <gohman@apple.com>
Mon, 23 Mar 2009 17:39:36 +0000 (17:39 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 23 Mar 2009 17:39:36 +0000 (17:39 +0000)
actually have uses, which reflects the way it's used.

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

lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp

index 303f8cc6a615af1ef48970cc663355e0bdac2d96..7aa15bcc6862e97f0b7ffe46d45c4a02cb03b572 100644 (file)
@@ -175,7 +175,10 @@ void ScheduleDAGSDNodes::AddSchedEdges() {
       if (N->isMachineOpcode() &&
           TII->get(N->getMachineOpcode()).getImplicitDefs()) {
         SU->hasPhysRegClobbers = true;
-        if (CountResults(N) > TII->get(N->getMachineOpcode()).getNumDefs())
+        unsigned NumUsed = CountResults(N);
+        while (NumUsed != 0 && !N->hasAnyUseOfValue(NumUsed - 1))
+          --NumUsed;    // Skip over unused values at the end.
+        if (NumUsed > TII->get(N->getMachineOpcode()).getNumDefs())
           SU->hasPhysRegDefs = true;
       }