diff options
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp index a685d2e23d5..39f7875cb3f 100644 --- a/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp @@ -343,7 +343,11 @@ void Win64Exception::emitCXXFrameHandler3Table(const MachineFunction *MF) { } } - if (ParentF != F) + // Defer emission until we've visited the parent function and all the catch + // handlers. + if (ParentF == F || FuncInfo.CatchHandlerMaxState.count(F)) + ++FuncInfo.NumIPToStateFuncsVisited; + if (FuncInfo.NumIPToStateFuncsVisited != FuncInfo.CatchHandlerMaxState.size()) return; MCSymbol *UnwindMapXData = nullptr; diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp index 8eac8eb4f1b..65a67265d79 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp @@ -275,11 +275,15 @@ void FunctionLoweringInfo::set(const Function &fn, MachineFunction &mf, MBBMap[Invoke->getSuccessor(1)]->setIsLandingPad(); // Calculate EH numbers for WinEH. - if (fn.getFnAttribute("wineh-parent").getValueAsString() == fn.getName()) { - WinEHNumbering Num(MMI.getWinEHFuncInfo(&fn)); - Num.calculateStateNumbers(fn); - // Pop everything on the handler stack. - Num.processCallSite(None, ImmutableCallSite()); + if (fn.hasFnAttribute("wineh-parent")) { + const Function *WinEHParentFn = MMI.getWinEHParent(&fn); + WinEHFuncInfo &FI = MMI.getWinEHFuncInfo(WinEHParentFn); + if (FI.LandingPadStateMap.empty()) { + WinEHNumbering Num(FI); + Num.calculateStateNumbers(*WinEHParentFn); + // Pop everything on the handler stack. + Num.processCallSite(None, ImmutableCallSite()); + } } } |