This is an archive of the discontinued LLVM Phabricator instance.

[ObjCARCOpt] Port objc-arc to NPM
ClosedPublic

Authored by aeubanks on Aug 18 2020, 4:41 PM.

Details

Summary

Since doInitialization() in the legacy pass modifies the module, the NPM
pass is a Module pass.

Diff Detail

Event Timeline

aeubanks created this revision.Aug 18 2020, 4:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2020, 4:41 PM
aeubanks requested review of this revision.Aug 18 2020, 4:41 PM
aeubanks updated this revision to Diff 286429.

Remove unnecessary imports

aeubanks updated this revision to Diff 288465.Aug 27 2020, 2:59 PM

Rebase
Add ObjCARC to Passes

ahatanak added inline comments.Aug 27 2020, 4:26 PM
llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
2502

Are the results of the analyses currently preserved by setPreservesCFG preserved by the new pass manager too? If they aren't, is there a way to avoid doing the analyses again?

aeubanks updated this revision to Diff 288487.Aug 27 2020, 5:42 PM

Preserve CFGAnalyses

aeubanks added inline comments.Aug 27 2020, 5:46 PM
llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
2502

Done below.

ahatanak accepted this revision.Aug 27 2020, 5:59 PM

OK, thank you. LGTM, but you can wait for an approval from someone more familiar with the pass manager.

This revision is now accepted and ready to land.Aug 27 2020, 5:59 PM
ychen added a comment.Aug 27 2020, 8:36 PM

It looks like belong to addFunctionSimplificationPasses. How about keeping it Function pass using initialization once?

It looks like belong to addFunctionSimplificationPasses. How about keeping it Function pass using initialization once?

The reason I made this a module pass instead of a function pass is because it adds function declarations when there is a call to EP.get(). I'm not sure if you're allowed to add function declarations in a function pass. If we were to try to parallelize function passes, that would be bad.
We could split the creation of all the functions in ARCRuntimeEntryPoints into a separate module pass, but that would have to be run right before this function pass and wouldn't help with adding it to a FunctionPassManager.

ychen accepted this revision.Aug 28 2020, 12:51 PM

It looks like belong to addFunctionSimplificationPasses. How about keeping it Function pass using initialization once?

The reason I made this a module pass instead of a function pass is because it adds function declarations when there is a call to EP.get(). I'm not sure if you're allowed to add function declarations in a function pass. If we were to try to parallelize function passes, that would be bad.
We could split the creation of all the functions in ARCRuntimeEntryPoints into a separate module pass, but that would have to be run right before this function pass and wouldn't help with adding it to a FunctionPassManager.

That makes sense to me. This also looks like something doInitilization could help with if the EP.get() could happen in doInitilization.

This revision was landed with ongoing or failed builds.Aug 28 2020, 1:01 PM
This revision was automatically updated to reflect the committed changes.