Legalize FORMAL_ARGUMENTS nodes correctly, we don't want to legalize them once
authorChris Lattner <sabre@nondot.org>
Tue, 16 May 2006 05:49:56 +0000 (05:49 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 16 May 2006 05:49:56 +0000 (05:49 +0000)
for each argument.

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

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 650aaae7df87acfbe8926505e811d0c218a83792..f63a09248b833121c2cc9d9a07c948ad765ec6dd 100644 (file)
@@ -819,9 +819,18 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
     
   case ISD::FORMAL_ARGUMENTS:
     // The only option for this is to custom lower it.
-    Result = TLI.LowerOperation(Result, DAG);
+    Result = TLI.LowerOperation(Result.getValue(0), DAG);
     assert(Result.Val && "Target didn't custom lower ISD::FORMAL_ARGUMENTS!");
-    break;
+    
+    // Since FORMAL_ARGUMENTS nodes produce multiple values, make sure to
+    // remember that we legalized all of them, so it doesn't get relegalized.
+    for (unsigned i = 0, e = Result.Val->getNumValues(); i != e; ++i) {
+      Tmp1 = LegalizeOp(Result.getValue(i));
+      if (Op.ResNo == i)
+        Tmp2 = Tmp1;
+      AddLegalizedOperand(SDOperand(Node, i), Tmp1);
+    }
+    return Tmp2;
         
   case ISD::BUILD_VECTOR:
     switch (TLI.getOperationAction(ISD::BUILD_VECTOR, Node->getValueType(0))) {