This is an archive of the discontinued LLVM Phabricator instance.

[ObjC][ARC] Let ARC optimizer bail out if the number of pointer states it keeps track of becomes too large
ClosedPublic

Authored by ahatanak on Apr 24 2019, 3:35 PM.

Details

Summary

ARC optimizer does a top-down and a bottom-up traversal of the whole function to pair up retain and release instructions and remove them. This can be expensive if the number of instructions in the function and pointer states it tracks are large since it has to look at each pointer state and determine whether the instruction being visited can potentially use the pointer (see the loop in ObjCARCOpt::VisitInstructionBottomUp that calls HandlePotentialUse).

This patch adds a command line option that sets a limit to the number of pointers it tracks.

rdar://problem/49477063

Diff Detail

Repository
rL LLVM

Event Timeline

ahatanak created this revision.Apr 24 2019, 3:35 PM
pete accepted this revision.Apr 24 2019, 3:38 PM

Wow. That must be a huge test case for this to be a problem!

LGTM.

This revision is now accepted and ready to land.Apr 24 2019, 3:38 PM

The test case I'm looking at has a function with over 500k instructions and lots of ObjC runtime function calls.

LGTM

The test case I'm looking at has a function with over 500k instructions and lots of ObjC runtime function calls.

smeenai accepted this revision.Apr 24 2019, 5:28 PM
This revision was automatically updated to reflect the committed changes.