EH: Prune unreachable resume instructions during Dwarf EH preparation
authorReid Kleckner <reid@kleckner.net>
Fri, 20 Feb 2015 01:00:19 +0000 (01:00 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 20 Feb 2015 01:00:19 +0000 (01:00 +0000)
commit0b647e6cca16a55cce3d7e4dcc86b75273a5598b
treee3931a7fe2595e085ca754f1df46c16ae67330b9
parent0d94fa98e53c851f7646666a49bc1a01fa7d9782
EH: Prune unreachable resume instructions during Dwarf EH preparation

Today a simple function that only catches exceptions and doesn't run
destructor cleanups ends up containing a dead call to _Unwind_Resume
(PR20300). We can't remove these dead resume instructions during normal
optimization because inlining might introduce additional landingpads
that do have cleanups to run. Instead we can do this during EH
preparation, which is guaranteed to run after inlining.

Fixes PR20300.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D7744

llvm-svn: 229944
llvm/include/llvm/CodeGen/Passes.h
llvm/lib/CodeGen/CodeGen.cpp
llvm/lib/CodeGen/DwarfEHPrepare.cpp
llvm/lib/CodeGen/WinEHPrepare.cpp
llvm/test/CodeGen/Mips/eh.ll
llvm/test/CodeGen/X86/dwarf-eh-prepare.ll
llvm/test/CodeGen/X86/gcc_except_table.ll
llvm/test/CodeGen/X86/gcc_except_table_functions.ll
llvm/test/CodeGen/XCore/exception.ll