Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46609 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 04c4e01..4d1e7eb 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2621,7 +2621,8 @@
     if (MMI && RSI.getContext() && MMI->Verify(RSI.getContext())) {
       unsigned LabelID = MMI->RecordRegionStart(RSI.getContext());
       DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
-                              DAG.getConstant(LabelID, MVT::i32)));
+                              DAG.getConstant(LabelID, MVT::i32),
+                              DAG.getConstant(0, MVT::i32)));
     }
 
     return 0;
@@ -2631,8 +2632,9 @@
     DbgRegionEndInst &REI = cast<DbgRegionEndInst>(I);
     if (MMI && REI.getContext() && MMI->Verify(REI.getContext())) {
       unsigned LabelID = MMI->RecordRegionEnd(REI.getContext());
-      DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other,
-                              getRoot(), DAG.getConstant(LabelID, MVT::i32)));
+      DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
+                              DAG.getConstant(LabelID, MVT::i32),
+                              DAG.getConstant(0, MVT::i32)));
     }
 
     return 0;
@@ -2643,8 +2645,9 @@
     if (MMI && FSI.getSubprogram() &&
         MMI->Verify(FSI.getSubprogram())) {
       unsigned LabelID = MMI->RecordRegionStart(FSI.getSubprogram());
-      DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other,
-                  getRoot(), DAG.getConstant(LabelID, MVT::i32)));
+      DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
+                              DAG.getConstant(LabelID, MVT::i32),
+                              DAG.getConstant(0, MVT::i32)));
     }
 
     return 0;
@@ -2972,7 +2975,8 @@
     // used to detect deletion of the invoke via the MachineModuleInfo.
     BeginLabel = MMI->NextLabelID();
     DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
-                            DAG.getConstant(BeginLabel, MVT::i32)));
+                            DAG.getConstant(BeginLabel, MVT::i32),
+                            DAG.getConstant(1, MVT::i32)));
   }
 
   std::pair<SDOperand,SDOperand> Result =
@@ -2989,7 +2993,8 @@
     // can be used to detect deletion of the invoke via the MachineModuleInfo.
     EndLabel = MMI->NextLabelID();
     DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(),
-                            DAG.getConstant(EndLabel, MVT::i32)));
+                            DAG.getConstant(EndLabel, MVT::i32),
+                            DAG.getConstant(1, MVT::i32)));
 
     // Inform MachineModuleInfo of range.
     MMI->addInvoke(LandingPad, BeginLabel, EndLabel);
@@ -4573,7 +4578,8 @@
     // landing pad can thus be detected via the MachineModuleInfo.
     unsigned LabelID = MMI->addLandingPad(BB);
     DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, DAG.getEntryNode(),
-                            DAG.getConstant(LabelID, MVT::i32)));
+                            DAG.getConstant(LabelID, MVT::i32),
+                            DAG.getConstant(1, MVT::i32)));
 
     // Mark exception register as live in.
     unsigned Reg = TLI.getExceptionAddressRegister();