[PATCH] D83013: [LPM] Port CGProfilePass from NPM to LPM

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 8 04:53:53 PDT 2020


hans added a comment.

In D83013#2137607 <https://reviews.llvm.org/D83013#2137607>, @MaskRay wrote:

> `Opts.getProfileUse() != CodeGenOptions::ProfileNone ` in
>
>   Opts.CallGraphProfile = Opts.getProfileUse() != CodeGenOptions::ProfileNone &&
>                             !Opts.DisableIntegratedAS;
>
>
> is redundant. CGProfile.cpp is a no-op if no function provides `getEntryFreq()`.


It's a functional no-op, but it runs the BFI analysis, which as Nikita pointed out above adds some compile-time cost. Not scheduling the pass unless we're using profile info seems like a reasonable way to avoid that cost to me.

The alternative of using LazyBlockFrequencyInfoPass and checking PSI->hasProfileSummary() first would also work I guess. If you think that's cleaner, maybe that's the better way to go.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83013/new/

https://reviews.llvm.org/D83013





More information about the cfe-commits mailing list