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

Anton Bikineev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 05:44:51 PDT 2022


AntonBikineev added a comment.



> 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.

> 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


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