[llvm] [VPlan] Model branch cond to enter scalar epilogue in VPlan. (PR #92651)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 16:24:36 PDT 2024
================
@@ -7538,6 +7498,18 @@ LoopVectorizationPlanner::executePlan(
ILV.printDebugTracesAtEnd();
+ // Adjust branch weight of the branch in the middle block.
+ auto *MiddleTerm =
+ cast<BranchInst>(State.CFG.VPBB2IRBB[ExitVPBB]->getTerminator());
+ if (MiddleTerm->isConditional() &&
+ hasBranchWeightMD(*OrigLoop->getLoopLatch()->getTerminator())) {
----------------
ayalz wrote:
Thoughts independent of this patch:
- record an indicator that the branch has weights.
- assign new branch weights regardless of existing ones, as the new weights are independent of the old ones.
- assign more accurate weights if trip-count and VFxUF are known to have a (greatest) common divider.
https://github.com/llvm/llvm-project/pull/92651
More information about the llvm-commits
mailing list