[PATCH] D158642: LoopUnrollRuntime: Add weights to all branches

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 11:01:11 PDT 2023


MatzeB added subscribers: spatel, lebedev.ri.
MatzeB added a comment.

I guess we may need a discussion about how to express these "nearly always taken" / "nearly never taken" branch weights as a hardcoded 1:127 ratio is pretty arbitrary.

Looking around I see `LikelyBranchWeight` in `llvm/Transforms/Scalar/LowerExpectIntrinsic.cpp` but it's private to the pass and a warning advises to use `TargetTransformInfo::getPredictableBranchThreshold()`. Intuitively it feels wrong to me to have branch_weights change based on the selected target, and I am not sure I follow why `LowerExpectIntrinsic` isn't using that function either despite recommending it...

CC @lebedev.ri @spatel


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158642



More information about the llvm-commits mailing list