[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 13:03:20 PDT 2023


mtrofin accepted this revision.
mtrofin added inline comments.
This revision is now accepted and ready to land.


================
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);
----------------
MatzeB wrote:
> mtrofin wrote:
> > can either of the VF methods return 0?
> I don't think vectorizing with a vector width of 0 (or a minimum of 0) can happen.
Ack, maybe an `assert` about that might be well placed here?


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