This is an archive of the discontinued LLVM Phabricator instance.

[NewPM] Make pass adaptors less templatey
ClosedPublic

Authored by aeubanks on Dec 3 2020, 3:48 PM.

Details

Summary

Currently PassBuilder.cpp is by far the file that takes longest to
compile. This is due to tons of templates being instantiated per pass.

Follow PassManager by using wrappers around passes to avoid making
the adaptors templated on the pass type. This allows us to move various
adaptors' run methods into .cpp files.

This reduces the compile time of PassBuilder.cpp on my machine from 66
to 39 seconds. It also reduces the size of opt from 685M to 676M.

Diff Detail

Event Timeline

aeubanks created this revision.Dec 3 2020, 3:48 PM
aeubanks requested review of this revision.Dec 3 2020, 3:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2020, 3:48 PM
aeubanks updated this revision to Diff 309405.Dec 3 2020, 4:50 PM

add missed references

This seems like a great improvement!

llvm/lib/Passes/StandardInstrumentations.cpp
476

Could / should these changes to use isIgnored be committed separately / ahead of time?

llvm/lib/Transforms/Scalar/LoopPassManager.cpp
89

Can adding this comment be pulled out to a separate commit? It seems unrelated to this change.

aeubanks marked an inline comment as done.Dec 3 2020, 6:14 PM
aeubanks added inline comments.
llvm/lib/Passes/StandardInstrumentations.cpp
476

it is related to this change but can be done ahead of time: https://reviews.llvm.org/D92625

llvm/lib/Transforms/Scalar/LoopPassManager.cpp
89

this seems fairly benign to me, but sure

dexonsmith accepted this revision.Dec 3 2020, 6:32 PM

Once you've rebased on the other changes this LGTM.

llvm/lib/Passes/StandardInstrumentations.cpp
476

Thanks!

llvm/lib/Transforms/Scalar/LoopPassManager.cpp
89

Thanks, I don't think it needs review or anything, but I had to stare at the diff for a while to see what had happened to the braces... if you commit unrelated comment / whitespace changes separately then later when people look at the log / blame / etc. it'll be a bit cleaner (in this chunk, the "new" brace will be the closing one for FunctionToLoopPassAdaptor::run instead of this one here)

This revision is now accepted and ready to land.Dec 3 2020, 6:32 PM
aeubanks updated this revision to Diff 309436.Dec 3 2020, 6:39 PM
aeubanks marked an inline comment as done.

rebase

This revision was automatically updated to reflect the committed changes.
rnk added a comment.Dec 7 2020, 12:27 PM

Just paged through this. Nice!