[PATCH] D159322: LoopVectorize: Set branch_weight for conditional branches
Mircea Trofin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 07:51:57 PDT 2023
mtrofin added a comment.
In D159322#4633005 <https://reviews.llvm.org/D159322#4633005>, @MatzeB wrote:
> For the discussion about the 127:1 ratio see also D158668 <https://reviews.llvm.org/D158668> (and discussion in D158642 <https://reviews.llvm.org/D158642> and D157462 <https://reviews.llvm.org/D157462>)
added a comment in D158642 <https://reviews.llvm.org/D158642> (api stuff, not actual weight values. xur@ might have an opinion about those)
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:1922
bool CostTooHigh = false;
+ bool AddBranchWeights;
----------------
This could be `const`, looks like, correct?
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2870
+ // It is unlikely that we enter "Bypass".
+ MDBuilder MDB(Builder.getContext());
+ MDNode *BranchWeights = MDB.createBranchWeights(1, 127);
----------------
worth factoring the 3 lines in a little utility?
================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:3110
+ unsigned TripCount = UF;
+ TripCount *= VF.isScalable() ? VF.getKnownMinValue() : VF.getFixedValue();
+ MDNode *BranchWeights = MDB.createBranchWeights(1, TripCount - 1);
----------------
can either of the VF methods return 0?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159322/new/
https://reviews.llvm.org/D159322
More information about the llvm-commits
mailing list