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/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
index c9fc812..ac35b40 100644
--- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
@@ -733,18 +733,16 @@
}
// Now that we have emitted all operands, emit this instruction itself.
- if (Opc == TargetInstrInfo::LABEL &&
+ if (ISD::isDebugLabel(Node) &&
!BB->empty() && &MF->front() == BB) {
- // If we are inserting a LABEL and this happens to be the first label in
- // the entry block, it is the "function start" label. Make sure there are
- // no other instructions before it.
+ // If we are inserting a debug label and this happens to be the first
+ // debug label in the entry block, it is the "function start" label.
+ // Make sure there are no other instructions before it.
unsigned NumLabels = 0;
MachineBasicBlock::iterator MBBI = BB->begin();
while (MBBI != BB->end()) {
- if (MBBI->getOpcode() == TargetInstrInfo::LABEL) {
- if (++NumLabels > 1)
- break;
- }
+ if (!MBBI->isDebugLabel() || ++NumLabels > 1)
+ break;
++MBBI;
}
if (NumLabels <= 1)