Fix incorrect legalization of EHSELECTOR. This fixes
authorChris Lattner <sabre@nondot.org>
Fri, 27 Apr 2007 17:12:52 +0000 (17:12 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 27 Apr 2007 17:12:52 +0000 (17:12 +0000)
CodeGen/Generic/2007-04-14-EHSelectorCrash.ll and PR1326

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

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 1835ce2f9c62d3a5d81730ef3cd5a9082955f9ce..99394c73a39d3ed93c2d5e0a99a96e9465b0c4d4 100644 (file)
@@ -692,12 +692,14 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       Result = TLI.LowerOperation(Op, DAG);
       if (Result.Val) break;
       // Fall Thru
-    case TargetLowering::Legal:
-      Result = DAG.getNode(ISD::MERGE_VALUES, VT, DAG.getConstant(0, VT), Tmp1).
-                  getValue(Op.ResNo);
+    case TargetLowering::Legal: {
+      SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp1 };
+      Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other),
+                           Ops, 2).getValue(Op.ResNo);
       break;
     }
     }
+    }
     break;
   case ISD::EHSELECTION: {
     Tmp1 = LegalizeOp(Node->getOperand(0));
@@ -714,12 +716,14 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
       Result = TLI.LowerOperation(Op, DAG);
       if (Result.Val) break;
       // Fall Thru
-    case TargetLowering::Legal:
-      Result = DAG.getNode(ISD::MERGE_VALUES, VT, DAG.getConstant(0, VT), Tmp2).
-                  getValue(Op.ResNo);
+    case TargetLowering::Legal: {
+      SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp2 };
+      Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other),
+                           Ops, 2).getValue(Op.ResNo);
       break;
     }
     }
+    }
     break;
   case ISD::AssertSext:
   case ISD::AssertZext: