Add a Windows EH preparation pass that zaps resumes
authorReid Kleckner <reid@kleckner.net>
Thu, 29 Jan 2015 00:41:44 +0000 (00:41 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 29 Jan 2015 00:41:44 +0000 (00:41 +0000)
commitf77571aeac02dce3dd3b5329678b9ca9e50c9da0
treede8fb4f5f29d6b58bea43b5c0a3e0c655c4e9ac0
parentbd2a7002089ebc74f6415d12162dc05c51553ecf
Add a Windows EH preparation pass that zaps resumes

If the personality is not a recognized MSVC personality function, this
pass delegates to the dwarf EH preparation pass. This chaining supports
people on *-windows-itanium or *-windows-gnu targets.

Currently this recognizes some personalities used by MSVC and turns
resume instructions into traps to avoid link errors.  Even if cleanups
are not used in the source program, LLVM requires the frontend to emit a
code path that resumes unwinding after an exception.  Clang does this,
and we get unreachable resume instructions. PR20300 covers cleaning up
these unreachable calls to resume.

Reviewers: majnemer

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227405 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/Passes.h
include/llvm/InitializePasses.h
lib/CodeGen/CMakeLists.txt
lib/CodeGen/Passes.cpp
lib/CodeGen/WinEHPrepare.cpp [new file with mode: 0644]
test/CodeGen/X86/seh-safe-div.ll
test/CodeGen/X86/win_eh_prepare.ll [new file with mode: 0644]
tools/opt/opt.cpp