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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 06:54:50 PDT 2022


aaron.ballman added a comment.

In D134456#3814820 <https://reviews.llvm.org/D134456#3814820>, @AntonBikineev wrote:

>> No, it sounds like we need a proposal for `[[likely_unless_the_optimizer_decides_otherwise]]` -- the `[[likely]]` attribute was intended for always-likely optimization decisions.
>
> Well, whatever the default behavior is chosen.

Agreed -- and we can easily add such an attribute under the `clang` vendor namespace once we nail down the default behavior we want for `[[likely]]`.

>> I agree that we should be consistent, but there's different ways we can be consistent. Consistent with what the feature paper intended? Consistent with our past decisions? Consistent with how other implementations behave?
>
> What I meant is that if the status quo is preserved, the never taken [[likely]] branch would be considered as "unlikely'' after PGO (the purpose of this patch).
>
>> What do other implementations that support PGO do? If PGO implementations consistently behave a certain way, that would be interesting to know.
>
> I just checked GCC and it seems like it considers likely as a forcing optimization: https://godbolt.org/z/69E3383cq

Thanks for checking! It doesn't seem to have any impact on ICC one way or the other (at least from my simple testing).


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