Make sure that landing pad entries in the EH call site table are in the proper
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SelectionDAGBuilder.cpp
index a3fb34576ac0730884e8fab0ab816f406d06e4de..5b733a873ff7a8c38f75f0a0a607b6e085b5db83 100644 (file)
@@ -5049,6 +5049,12 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
     // used to detect deletion of the invoke via the MachineModuleInfo.
     BeginLabel = MMI->NextLabelID();
 
+    // Keep track of which landing pads go with which invokes. SjLj uses
+    // this to maintain the ordering of pads in the LSDA. Dwarf ignores it.
+    Function *F = LandingPad->getParent()->getFunction();
+    MMI->setCallSiteBeginLabel(BeginLabel,
+                               F->getCallSiteNumber(CS.getInstruction()));
+
     // Both PendingLoads and PendingExports must be flushed here;
     // this call might not return.
     (void)getRoot();