Don't mark registers dead here when processing nodes with MVT::Flag
authorDan Gohman <gohman@apple.com>
Fri, 30 Oct 2009 23:57:47 +0000 (23:57 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 30 Oct 2009 23:57:47 +0000 (23:57 +0000)
results. This works around a problem affecting targets which rely on
MVT::Flag to handle physical register defs.

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

lib/CodeGen/SelectionDAG/InstrEmitter.cpp

index e727bc9f33b34e642e17d791920ab574eb31b2ee..da311eddcae98a746e55f75c76d3b35d75fa0d5b 100644 (file)
@@ -573,7 +573,11 @@ void InstrEmitter::EmitNode(SDNode *Node, bool IsClone, bool IsCloned,
         unsigned Reg = II.getImplicitDefs()[i - II.getNumDefs()];
         if (Node->hasAnyUseOfValue(i))
           EmitCopyFromReg(Node, i, IsClone, IsCloned, Reg, VRBaseMap);
-        else
+        // If there are no uses, mark the register as dead now, so that
+        // MachineLICM/Sink can see that it's dead. Don't do this if the
+        // node has a Flag value, for the benefit of targets still using
+        // Flag for values in physregs.
+        else if (Node->getValueType(Node->getNumValues()-1) != MVT::Flag)
           MI->addRegisterDead(Reg, TRI);
       }
     }