Fix custom lowering of dynamic_stackalloc
authorChris Lattner <sabre@nondot.org>
Sun, 15 Jan 2006 08:43:08 +0000 (08:43 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 15 Jan 2006 08:43:08 +0000 (08:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25329 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 57a9b1d7765d2c2e7b70976d0d04058b56d61d1e..7903fa68d7cac16540776d849e54160c502d2a4d 100644 (file)
@@ -842,22 +842,25 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
     } else
       Result = Op.getValue(0);
 
+    Tmp1 = Result;
+    Tmp2 = Result.getValue(1);
     switch (TLI.getOperationAction(Node->getOpcode(),
                                    Node->getValueType(0))) {
     default: assert(0 && "This action is not supported yet!");
     case TargetLowering::Custom: {
-      SDOperand Tmp = TLI.LowerOperation(Result, DAG);
-      if (Tmp.Val) {
-        Result = LegalizeOp(Tmp);
+      Tmp3 = TLI.LowerOperation(Tmp1, DAG);
+      if (Tmp3.Val) {
+        Tmp1 = LegalizeOp(Tmp3);
+        Tmp2 = LegalizeOp(Tmp3.getValue(1));
       }
       // FALLTHROUGH if the target thinks it is legal.
     }
     case TargetLowering::Legal:
       // Since this op produce two values, make sure to remember that we
       // legalized both of them.
-      AddLegalizedOperand(SDOperand(Node, 0), Result);
-      AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1));
-      return Result.getValue(Op.ResNo);
+      AddLegalizedOperand(SDOperand(Node, 0), Tmp1);
+      AddLegalizedOperand(SDOperand(Node, 1), Tmp2);
+      return Op.ResNo ? Tmp2 : Tmp1;
     }
     assert(0 && "Unreachable");
   }