This is an archive of the discontinued LLVM Phabricator instance.

[OpenMPOpt] Most SCC's are uninteresting, don't waste time on them (up to 16x faster)
ClosedPublic

Authored by lebedev.ri on Jul 27 2020, 11:55 AM.

Details

Summary

This seems obvious in hindsight, but the result is surprising.
I've measured compile-time of -openmpopt pass standalone
on RawSpeed unity build, and while there is some OpenMP stuff,
most is not OpenMP. But nonetheless the pass does a lot of costly
preparations before ever trying to look for OpenMP stuff in SCC.

Numbers (n=25): 0.094624s -> 0.005976s, an -93.68% improvement, or ~16x

Diff Detail

Event Timeline

lebedev.ri created this revision.Jul 27 2020, 11:55 AM
lebedev.ri retitled this revision from [OpenMPOpt][OldPM!] Most SCC's are uninteresting, don't waste time on them to [OpenMPOpt] Most SCC's are uninteresting, don't waste time on them (up to 16x faster).
lebedev.ri edited the summary of this revision. (Show Details)

As per IRC disscussion, let's do the (identical!) check in another way,
by recording in a set which functions are known to have openmp runtime calls,
and simply looking each function in SCC in that set.
This appears to be identical in the sense of detection
(though, if the omp functions are used only by constantexprs, we'll miss those cases.),
and at least not worse performance-wise.

As a bonus, works for NewPM!

lebedev.ri edited the summary of this revision. (Show Details)Jul 27 2020, 1:22 PM
jdoerfert accepted this revision.Jul 27 2020, 1:33 PM

LGTM, thanks for discovering and fixing this :)

llvm/lib/Transforms/IPO/OpenMPOpt.cpp
1415–1421
  1. For now ;)
  2. missing ., also above.
This revision is now accepted and ready to land.Jul 27 2020, 1:33 PM

LGTM, thanks for discovering and fixing this :)

Thank you for review! :)

This revision was automatically updated to reflect the committed changes.
lebedev.ri marked an inline comment as done.