OSDN Git Service

Fix inliner funclet unwind memoization
authorJoseph Tremoulet <jotrem@microsoft.com>
Sun, 4 Sep 2016 01:23:20 +0000 (01:23 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Sun, 4 Sep 2016 01:23:20 +0000 (01:23 +0000)
commit37c54c60a59e31d86bdceb3775fc0daffadf2bcd
tree5f63cd6da3ad0a4dda1ed55f6ec2ac0e1df617bd
parent1ce43697d186203a450c60b158d5188bbc3061fe
Fix inliner funclet unwind memoization

Summary:
The inliner may need to determine where a given funclet unwinds to,
and this determination may depend on other funclets throughout the
funclet tree.  The code that performs this walk in getUnwindDestToken
memoizes results to avoid redundant computations.  In the case that
a funclet's unwind destination is derived from its ancestor, there's
code to walk back down the tree from the ancestor updating the memo
map of its descendants to record the unwind destination.  This change
fixes that code to account for the case that some descendant has a
different unwind destination, which can happen if that unwind dest
is a descendant of the EHPad being queried and thus didn't determine
its unwind destination.

Also update test inline-funclets.ll, which is supposed to cover such
scenarios, to include a case that fails an assertion without this fix
but passes with it.

Fixes PR29151.

Reviewers: majnemer

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24117

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280610 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/InlineFunction.cpp
test/Transforms/Inline/inline-funclets.ll