[PATCH] D159322: LoopVectorize: Set branch_weight for conditional branches

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 18:02:57 PDT 2023


MatzeB created this revision.
MatzeB added reviewers: davidxl, wenlei, hoy, mtrofin, paulkirth, xur, fhahn.
Herald added subscribers: artagnon, shiva0217, sunshaoce, StephenFan, modimo, hiraditya, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

Consistently add `branch_weights` metadata in any condition branch created from `LoopVectorize.cpp`:

- Will only add metadata if the original loop-latch branch had metadata assigned.
- Most checks should rarely trigger so I am using a 127:1 ratio.
- For the middle block we assume an equal distribution of modulo results.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D159322

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/branch-weights.ll
  llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159322.555212.patch
Type: text/x-patch
Size: 29136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230901/cd2df8fc/attachment-0001.bin>


More information about the llvm-commits mailing list