This is an archive of the discontinued LLVM Phabricator instance.

[FuncSpec] Don't run the solver if there's nothing to do
ClosedPublic

Authored by SjoerdMeijer on Oct 12 2021, 7:49 AM.

Details

Summary

Even if there are no interesting functions, the SCCP solver would still run before bailing and doing nothing. Now bail earlier, avoid running the solver for nothing.

Diff Detail

Unit TestsFailed

Event Timeline

SjoerdMeijer created this revision.Oct 12 2021, 7:49 AM
SjoerdMeijer requested review of this revision.Oct 12 2021, 7:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2021, 7:49 AM
snehasish added inline comments.Oct 12 2021, 9:37 AM
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
836

Consider replacing with if(TrackedFuncs.empty()). IMO its a little easier to read.

Also I wonder if moving lines 822-831 before we define RunSCCPSolver on L793 makes it easier to read. I was confused for a bit before realizing that L793 is creating a functor. Wdyt?

llvm/test/Transforms/FunctionSpecialization/function-specialization-nothing-todo.ll
20

typo: absence

LGTM with @snehasish's comment addressed.

Thanks for the review and suggestions, comments addressed.

This revision is now accepted and ready to land.Oct 13 2021, 3:43 AM
This revision was landed with ongoing or failed builds.Oct 13 2021, 11:07 AM
This revision was automatically updated to reflect the committed changes.