]> granicus.if.org Git - llvm/commit
[coroutines] Handle unwind edge splitting
authorGor Nishanov <GorNishanov@gmail.com>
Tue, 16 May 2017 14:11:39 +0000 (14:11 +0000)
committerGor Nishanov <GorNishanov@gmail.com>
Tue, 16 May 2017 14:11:39 +0000 (14:11 +0000)
commit9c7e9d267643df920ec12a9e1fbd5f5118a7783f
tree00c50b3d6601bb4b22f2e3a8967e483cac6f6e72
parent45dd650ab583e911836f0f2eb8ba9c7d6a79029d
[coroutines] Handle unwind edge splitting

Summary:
RewritePHIs algorithm used in building of CoroFrame inserts a placeholder
```
%placeholder = phi [%val]
```
on every edge leading to a block starting with PHI node with multiple incoming edges,
so that if one of the incoming values was spilled and need to be reloaded, we have a
place to insert a reload. We use SplitEdge helper function to split the incoming edge.

SplitEdge function does not deal with unwind edges comping into a block with an EHPad.

This patch adds an ehAwareSplitEdge function that can correctly split the unwind edge.

For landing pads, we clone the landing pad into every edge block and replace the original
landing pad with a PHI collection the values from all incoming landing pads.

For WinEH pads, we keep the original EHPad in place and insert cleanuppad/cleapret in the
edge blocks.

Reviewers: majnemer, rnk

Reviewed By: majnemer

Subscribers: EricWF, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303172 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Coroutines/CoroFrame.cpp
test/Transforms/Coroutines/coro-eh-aware-edge-split.ll [new file with mode: 0644]