[llvm] [VPlan] Model cost of safe-divisor in VPlan (PR #154468)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 02:01:00 PDT 2025


================
@@ -7949,6 +7949,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
       VPValue *One =
           Plan.getOrAddLiveIn(ConstantInt::get(I->getType(), 1u, false));
       auto *SafeRHS = Builder.createSelect(Mask, Ops[1], One, I->getDebugLoc());
+      SafeRHS->setUnderlyingValue(I);
----------------
lukel97 wrote:

I think your approach of adding the cost of the select to the legacy cost model in #152707 actually makes more sense! Since its one less legacy-bailout we need to have in the VPlan cost model.

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


More information about the llvm-commits mailing list