diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-07-13 20:41:46 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-07-13 20:41:46 +0000 |
commit | 9a1a9194653ef5aa15ef32120c26f39c22a5332f (patch) | |
tree | dc3c2e1fef68cca24f28d9a207c71288dde9ce84 /llvm/test | |
parent | d8861517bf508804d176a635c809556a0d78fea6 (diff) | |
download | bcm5719-llvm-9a1a9194653ef5aa15ef32120c26f39c22a5332f.tar.gz bcm5719-llvm-9a1a9194653ef5aa15ef32120c26f39c22a5332f.zip |
[WinEH] Emit the LSDA even if no lpads remain but outlining occurred
The outlined funclets call intrinsics which reference labels from the
LSDA. This situation can easily arise in small functions with a single
cleanup at -O0, where Clang marks a definition as nounwind, and then
WinEHPrepare "discovers" that the landingpad is dead by accident and
deletes it.
We now need to ask the LLVM IR Function for it's personality directly,
rather than going through MachineModuleInfo.
Fixes PR23892.
llvm-svn: 242063
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/X86/cppeh-nounwind.ll | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/cppeh-nounwind.ll b/llvm/test/CodeGen/X86/cppeh-nounwind.ll new file mode 100644 index 00000000000..d9bc001a92d --- /dev/null +++ b/llvm/test/CodeGen/X86/cppeh-nounwind.ll @@ -0,0 +1,35 @@ +; RUN: llc -mtriple=i686-pc-windows-msvc < %s | FileCheck %s + +; Sometimes invokes of nounwind functions make it through to CodeGen, especially +; at -O0, where Clang sometimes optimistically annotates functions as nounwind. +; WinEHPrepare ends up outlining functions, and emitting references to LSDA +; labels. Make sure we emit the LSDA in that case. + +declare i32 @__CxxFrameHandler3(...) +declare void @nounwind_func() nounwind +declare void @cleanup() + +define void @should_emit_tables() personality i32 (...)* @__CxxFrameHandler3 { +entry: + invoke void @nounwind_func() + to label %done unwind label %lpad + +done: + ret void + +lpad: + %vals = landingpad { i8*, i32 } + cleanup + call void @cleanup() + resume { i8*, i32 } %vals +} + +; CHECK: _should_emit_tables: +; CHECK: calll _nounwind_func +; CHECK: retl + +; CHECK: L__ehtable$should_emit_tables: + +; CHECK: ___ehhandler$should_emit_tables: +; CHECK: movl $L__ehtable$should_emit_tables, %eax +; CHECK: jmp ___CxxFrameHandler3 # TAILCALL |