[WinEH] Don't inline an 'unwinds to caller' cleanupret into funclets which locally...
authorDavid Majnemer <david.majnemer@gmail.com>
Tue, 23 Feb 2016 17:11:04 +0000 (17:11 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Tue, 23 Feb 2016 17:11:04 +0000 (17:11 +0000)
commit223538f76481821d5bf99bf69e73727226233167
treeaf5787d8c7919eb475f1a21fa1d52e6310364153
parent1e1f830e9322c16e16d51f39671e4e65c73d38b7
[WinEH] Don't inline an 'unwinds to caller' cleanupret into funclets which locally unwind

It is problematic if the inlinee has a cleanupret which unwinds to
caller and we inline it into a call site which doesn't unwind.

If the funclet unwinds anywhere other than to the caller,
then we will give the funclet two unwind destinations.
This will result in a verifier failure.

Seeing as how the caller wasn't an invoke (which would locally unwind)
and that the funclet cannot unwind to caller, we must conclude that an
'unwind to caller' cleanupret is dynamically unreachable.

This fixes PR26698.

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

llvm-svn: 261656
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/Inline/pr26698.ll [new file with mode: 0644]