Do not emit copies for physical register output if it's not used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40722 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index 3738702..192b076 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -676,7 +676,8 @@
     if (HasPhysRegOuts) {
       for (unsigned i = II.numDefs; i < NumResults; ++i) {
         unsigned Reg = II.ImplicitDefs[i - II.numDefs];
-        EmitCopyFromReg(Node, i, Reg, VRBaseMap);
+        if (Node->hasAnyUseOfValue(i))
+          EmitCopyFromReg(Node, i, Reg, VRBaseMap);
       }
     }
   } else {