[llvm] [VPlan] Model branch cond to enter scalar epilogue in VPlan. (PR #92651)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 03:59:18 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())) {
----------------
fhahn wrote:

Where should we record it? Ideally on the branch-on-cond VPInst, but that would require supporting metadata on VPinst at least.

https://github.com/llvm/llvm-project/pull/92651


More information about the llvm-commits mailing list