[PATCH] D158642: LoopUnrollRuntime: Add branch weights to newly created branches

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 23 10:35:19 PDT 2023


MatzeB created this revision.
MatzeB added reviewers: wenlei, davidxl, hoy, paulkirth, dnovillo, mtrofin.
Herald added subscribers: modimo, zzheng, hiraditya, mcrosier.
Herald added a project: All.
MatzeB requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Make sure every conditional branch constructed by `LoopUnrollRuntime` code sets branch weights.

- Add new 1:127 weights for the conditional jumps checking whether the whole (unrolled) loop should be skipped in the generated prolog or epilog code.
- Remove `updateLatchBranchWeightsForRemainderLoop` function and just add weights immediately when constructing the relevant branches. This leads to simpler code and makes the code more obvious as every call to `CreateCondBr` now has a `BranchWeights` parameter.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158642

Files:
  llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
  llvm/test/Transforms/LoopUnroll/runtime-exit-phi-scev-invalidation.ll
  llvm/test/Transforms/LoopUnroll/runtime-loop.ll
  llvm/test/Transforms/LoopUnroll/unroll-heuristics-pgo.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158642.552790.patch
Type: text/x-patch
Size: 17818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230823/8a6234e5/attachment.bin>


More information about the llvm-commits mailing list