Page MenuHomePhabricator

[ObjCARC] Account for funclet token in storeStrong transform

Authored by smeenai on Apr 19 2018, 7:00 PM.



When creating a call to storeStrong in ObjCARCContract, ensure the call
gets the correct funclet token, otherwise WinEHPrepare will turn the
call (and all subsequent instructions) into unreachable.

We already have logic to do this for the ARC autorelease elision marker;
factor that out into a common function that's used for both. These are
the only two places in this transform that create call instructions.

Diff Detail


Event Timeline

smeenai created this revision.Apr 19 2018, 7:00 PM
rnk accepted this revision.Apr 20 2018, 11:23 AM


I'm unhappy with the need for instrumentation passes to "color" their inserted call instructions. It's a real drag. What we really want here are single-entry, multi-exit regions. If you ignore unreachable, then funclets are already single-entry, single-exit regions. Unfortunately, unreachable is very very common, because it comes after throw, which always calls a noreturn function. So this is common:

try { may_throw(); } catch (...) { do_something(); throw; /*unreachable*/ }
try { may_throw(); } catch (...) { do_something(); throw; /*unreachable*/ }

We needed to prevent simplifycfg from tail merging the two otherwise identical catch funclets that don't end in catchret.

If we could require instead that those unreachable instructions refer to their parent funclet, we'd be made in the shade. WinEHPrepare wouldn't have to do BB cloning anymore.

Throw it on the TODO list, I guess.

This revision is now accepted and ready to land.Apr 20 2018, 11:23 AM
This revision was automatically updated to reflect the committed changes.