This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] Don't require LazyBlockFrequencyInfo at optnone
ClosedPublic

Authored by nikic on May 21 2020, 10:10 AM.

Details

Summary

While LazyBlockFrequencyInfo itself is lazy, the dominator tree and loop info analyses it requires are not. Drop the dependency on this pass in SelectionDAGIsel at O0. This makes for a ~0.6% O0 compile-time improvement.

Diff Detail

Event Timeline

nikic created this revision.May 21 2020, 10:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2020, 10:10 AM
hjyamauchi added inline comments.May 21 2020, 11:46 AM
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
447 ↗(On Diff #265532)

Can we have this explicitly query OptLevel like above to be in sync, as in

if (PSI && PSI->hasProfileSummary() && OptLevel != CodeGenOpt::None) {
  BFI = &getAnalysis<LazyBlockFrequencyInfoPass>().getBFI();
}

I think that would be safer against accidental cases where the above and this code get out of sync for some reason and BFI silently gets dropped. Also, this is in line with the code that uses 'UseMBPI' below (line 465).

nikic updated this revision to Diff 265580.May 21 2020, 12:45 PM

Check OptLevel instead of using getAnalysisIfAvailable.

nikic marked 2 inline comments as done.May 21 2020, 12:45 PM
nikic added inline comments.
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
447 ↗(On Diff #265532)

Good point, done!

hjyamauchi accepted this revision.May 26 2020, 8:53 AM
This revision is now accepted and ready to land.May 26 2020, 8:53 AM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.