[PATCH] D134456: [PGO] Consider parent context when weighing branches with likelyhood.

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 07:54:17 PDT 2022


dexonsmith added a comment.

In D134456#3827263 <https://reviews.llvm.org/D134456#3827263>, @aaron.ballman wrote:

> In D134456#3827185 <https://reviews.llvm.org/D134456#3827185>, @dexonsmith wrote:
>
>> This safety scenario sounds like it could differ within a file. Is a flag really the right control? Maybe what you want is a `[[noprofile]]`, similar to `[[noopt]]`, which selectively disables the profile where the user wants fine-grained control to ignore the profile.
>
> My understanding is that it's pretty rare for safety critical code to mix with non-safety critical code, so a flag sounds like the correct granularity to me in terms of the use cases I'm aware of.

In that case, maybe those files should just turn off PGO entirely. There's already a command-line for that:

- `-fprofile-use=...`: compiler should use the profile to improve performance (user hints lose when there's disagreement)
- default: no access to a profile; user hints by default

Maybe (if it doesn't exist yet) `-fno-profile-use` would be useful for easy cancellation.

In safety-critical code where you don't entirely trust the profile/coverage/compiler to do the right thing, why risk having the feature enabled at all?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134456



More information about the cfe-commits mailing list