[llvm] [LV] Support binary and unary operations with EVL-vectorization (PR #93854)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 13:25:19 PDT 2024


================
@@ -1385,6 +1387,57 @@ void VPlanTransforms::addActiveLaneMask(
     HeaderMask->replaceAllUsesWith(LaneMask);
 }
 
+/// Replace recipes with their EVL variants.
+static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
+  VPDominatorTree VPDT;
+  VPDT.recalculate(Plan);
+  DenseSet<VPRecipeBase *> ToRemove;
+
+  ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT(
+      Plan.getEntry());
+  DenseSet<VPValue *> HeaderMasks = collectAllHeaderMasks(Plan);
+  for (VPBasicBlock *VPBB :
+       reverse(VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT))) {
----------------
fhahn wrote:

I am not sure, I think the reason removeDeadRecipes does it in that order to remove later dead recipes before their users, but the current patch removes all replaced recipes, then removes the masks. The only operand that isn't used any longer when removing the original recipes is the mask, so I am not sure in what cases the order matters?


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


More information about the llvm-commits mailing list