[WinEHPrepare] Update demotion logic
authorJoseph Tremoulet <jotrem@microsoft.com>
Thu, 13 Aug 2015 14:30:10 +0000 (14:30 +0000)
committerJoseph Tremoulet <jotrem@microsoft.com>
Thu, 13 Aug 2015 14:30:10 +0000 (14:30 +0000)
commitccc0cf3d8de133f2e100ae3a69d0414479ae435f
tree93e99ff1a6d60f208b77a16b47376a4637007096
parent69585fd51be3cf8ebeec649f1d3ba33e47759a68
[WinEHPrepare] Update demotion logic

Summary:
Update the demotion logic in WinEHPrepare to avoid creating new cleanups by
walking predecessors as necessary to insert stores for EH-pad PHIs.

Also avoid creating stores for EH-pad PHIs that have no uses.

The store/load placement is still pretty naive.  Likely future improvements
(at least for optimized compiles) include:
 - Share loads for related uses as possible
 - Coalesce non-interfering use/def-related PHIs
 - Store at definition point rather than each PHI pred for non-interfering
   lifetimes.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

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