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/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 118f980..28d7006 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -173,6 +173,22 @@
   return true;
 }
 
+/// isDebugLabel - Return true if the specified node represents a debug
+/// label (i.e. ISD::LABEL or TargetInstrInfo::LANEL node and third operand
+/// is 0).
+bool ISD::isDebugLabel(const SDNode *N) {
+  SDOperand Zero;
+  if (N->getOpcode() == ISD::LABEL)
+    Zero = N->getOperand(2);
+  else if (N->isTargetOpcode() &&
+           N->getTargetOpcode() == TargetInstrInfo::LABEL)
+    // Chain moved to last operand.
+    Zero = N->getOperand(1);
+  else
+    return false;
+  return isa<ConstantSDNode>(Zero) && cast<ConstantSDNode>(Zero)->isNullValue();
+}
+
 /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X)
 /// when given the operation for (X op Y).
 ISD::CondCode ISD::getSetCCSwappedOperands(ISD::CondCode Operation) {