This is an archive of the discontinued LLVM Phabricator instance.

ObjCARC: teach the cloner about funclets
ClosedPublic

Authored by compnerd on Mar 9 2018, 2:05 PM.

Details

Summary

In the case that the CallInst that is being moved has an associated
operand bundle which is a funclet, the move will construct an invalid
instruction. The new site will have a different token and needs to be
reassociated with the new instruction.

Unfortunately, there is no way to alter the bundle after the
construction of the instruction. Replace the call instruction cloning
with a custom helper to clone the instruction and reassociate the
funclet token.

Diff Detail

Repository
rL LLVM

Event Timeline

compnerd created this revision.Mar 9 2018, 2:05 PM
compnerd added subscribers: rnk, majnemer.
majnemer added inline comments.Mar 9 2018, 2:33 PM
lib/Transforms/ObjCARC/ObjCARCOpts.cpp
702

What if the cleanuppad was introduced in a block which branched to this one?

compnerd updated this revision to Diff 137867.Mar 9 2018, 4:16 PM

Use the BB colorizer to detect the token. Fortunately, there is no BB removal/splitting happening here, so there is no state to maintain.

majnemer accepted this revision.Mar 9 2018, 5:20 PM

LGTM

lib/Transforms/ObjCARC/ObjCARCOpts.cpp
692

dyn_cast -> cast

Actually, why not just take a CallInst &?

698

Start the comment with an uppercase and end with a period.

This revision is now accepted and ready to land.Mar 9 2018, 5:20 PM
compnerd closed this revision.Mar 12 2018, 4:59 PM

SVN r327336. Addressed comments in SVN r327351, because I forgot to incorporate them in the first try.