This is an archive of the discontinued LLVM Phabricator instance.

[coroutines] Handle unwind edge splitting
ClosedPublic

Authored by GorNishanov on Apr 8 2017, 9:21 AM.
Tokens
"Mountain of Wealth" token, awarded by GorNishanov.

Details

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.

Diff Detail

Event Timeline

GorNishanov created this revision.Apr 8 2017, 9:21 AM
GorNishanov edited the summary of this revision. (Show Details)Apr 10 2017, 5:37 PM

Fixed typo in the description

soft ping: Coroutines are awesome!

Traditional weekly ping

This revision is now accepted and ready to land.May 15 2017, 8:02 PM
This revision was automatically updated to reflect the committed changes.