[WinEHPrepare] Fix catchret successor phi demotion
authorJoseph Tremoulet <jotrem@microsoft.com>
Mon, 17 Aug 2015 13:51:37 +0000 (13:51 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Mon, 17 Aug 2015 13:51:37 +0000 (13:51 +0000)
commit08b10aaafe0301cfde29692ee7c32752048b41fc
treee432e4bfcbe284ede0824f21928b82d7e1490619
parent378e97e50c4385095b4d0f482e57159c8de3164c
[WinEHPrepare] Fix catchret successor phi demotion

Summary:
When demoting an SSA value that has a use on a phi and one of the phi's
predecessors terminates with catchret, the edge needs to be split and the
load inserted in the new block, else we'll still have a cross-funclet SSA
value.

Add a test for this, and for the similar case where a def to be spilled is
on and invoke and a critical edge, which was already implemented but
missing a test.

Reviewers: majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245218 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/WinEHPrepare.cpp
test/CodeGen/WinEH/wineh-demotion.ll