[llvm] [VPlan] Preserve the branch weights of scalarized selects. (PR #224968)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 01:41:11 PDT 2026
================
@@ -527,6 +527,13 @@ void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan) {
vp_depth_first_deep(Plan.getEntry()))) {
for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
VPBuilder Builder(&R);
+ // !prof is only supported on scalar selects.
+ if (auto *Widen = dyn_cast<VPWidenRecipe>(&R)) {
+ if (Widen->getOpcode() == Instruction::Select &&
+ !vputils::isSingleScalar(Widen->getOperand(0)))
----------------
david-arm wrote:
Is it worth adding a TODO here to add support for vector conditions too? If the select is going to be scalarised, then each lane of the condition will become scalar and hence we can also support branch weights.
https://github.com/llvm/llvm-project/pull/224968
More information about the llvm-commits
mailing list