After early-lowering the FORMAL_ARGUMENTS node, delete it.
authorDan Gohman <gohman@apple.com>
Mon, 21 Jul 2008 21:04:07 +0000 (21:04 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 21 Jul 2008 21:04:07 +0000 (21:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53874 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index b500b6ab6b3f771b1c5382dd8a7254f6ae8d0740..12c54c1eeff175b9f1ab8bbc100423b8ab46cd11 100644 (file)
@@ -4686,6 +4686,13 @@ void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG,
           (Result->getNumValues()+1 == TmpRes.Val->getNumValues() &&
            TmpRes.getValue(Result->getNumValues()).getValueType() == MVT::Flag))
          && "Lowering produced unexpected number of results!");
+
+  // The FORMAL_ARGUMENTS node itself is likely no longer needed.
+  if (Result != TmpRes.Val && Result->use_empty()) {
+    HandleSDNode Dummy(DAG.getRoot());
+    DAG.RemoveDeadNode(Result);
+  }
+
   Result = TmpRes.Val;
   
   unsigned NumArgRegs = Result->getNumValues() - 1;