[WinEH] Clone funclets with multiple parents
authorAndrew Kaylor <andrew.kaylor@intel.com>
Fri, 6 Nov 2015 00:20:50 +0000 (00:20 +0000)
committerAndrew Kaylor <andrew.kaylor@intel.com>
Fri, 6 Nov 2015 00:20:50 +0000 (00:20 +0000)
commitb508d4bda28aad4454133be228e59c7d4b9cdbb6
tree68cbd2c9ca16df67b2b7f733fd499ab6d218e9f8
parent11e0c3127ee6fa56d92191e8475ab27dc4f3a1b8
[WinEH] Clone funclets with multiple parents

Windows EH funclets need to always return to a single parent funclet.  However, it is possible for earlier optimizations to combine funclets (probably based on one funclet having an unreachable terminator) in such a way that this condition is violated.

These changes add code to the WinEHPrepare pass to detect situations where a funclet has multiple parents and clone such funclets, fixing up the unwind and catch return edges so that each copy of the funclet returns to the correct parent funclet.

Differential Revision: http://reviews.llvm.org/D13274?id=39098

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252249 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AsmParser/LLParser.cpp
lib/CodeGen/WinEHPrepare.cpp
test/CodeGen/WinEH/wineh-cloning.ll
test/CodeGen/WinEH/wineh-demotion.ll
test/CodeGen/WinEH/wineh-multi-parent-cloning.ll [new file with mode: 0644]
test/CodeGen/WinEH/wineh-no-demotion.ll