From 5c65f58f6487dd5d9dec43d927dd9842e8b72ba2 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 10 Apr 2015 04:56:17 +0000 Subject: [WinEHPrepare] Don't rely on the order of IR The IPToState table must be emitted after we have generated labels for all functions in the table. Don't rely on the order of the list of globals. Instead, utilize WinEHFuncInfo to tell us how many catch handlers we expect to outline. Once we know we've visited all the catch handlers, emit the cppxdata. llvm-svn: 234566 --- llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/Win64Exception.cpp') 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; -- cgit v1.2.3