[llvm] [LV][EVL] Simplify EVL recipe transformation by using a single EVL mask. nfc (PR #152479)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 7 05:15:32 PDT 2025
================
@@ -2227,48 +2227,47 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
}
}
- // Try to optimize header mask recipes away to their EVL variants.
+ // Replace header masks with a mask equivalent to predicating by EVL:
+ //
+ // icmp ule widen-canonical-iv backedge-taken-count
+ // ->
+ // icmp ult step-vector, EVL
+ VPRecipeBase *EVLR = EVL.getDefiningRecipe();
+ VPBuilder Builder(EVLR->getParent(), std::next(EVLR->getIterator()));
+ Type *EVLType = TypeInfo.inferScalarType(&EVL);
+ VPValue *EVLMask = Builder.createICmp(
+ CmpInst::ICMP_ULT,
+ Builder.createNaryOp(VPInstruction::StepVector, {}, EVLType), &EVL);
----------------
lukel97 wrote:
Given that this runs after optimization maybe it's possible it might get optimized away? In that case we would end up with an unused EVLMask.
https://github.com/llvm/llvm-project/pull/152479
More information about the llvm-commits
mailing list