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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 12:22:54 PDT 2022


aaron.ballman added a comment.

I'm on the fence about this... the attributes were added as optimization hints, but for somewhat interesting use cases. The obvious one of "I think this path is likely/unlikely and so I'll help the compiler figure it out" was one such use case, but honestly that's akin to `inline` and `register` in terms of how likely it is the user will make a better decision than the optimizer. But the more interesting use case was "The optimizer is going to consider this to be the unlikely path, but I need it to be optimized because I need my failure code to fail as fast as possible". Basically, some folks wanted to use this to override the otherwise-reasonable decisions from the optimizer. Based on that, I'm not certain we should let PGO win -- the user is telling you "optimize based on something I know more about than you", and having a profile that covers the code path doesn't necessarily change that. WDYT?


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