[llvm] [LV] Convert uniform-address scatters to scalar store when unmasked or header-masked. (PR #166114)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 2 22:26:54 PST 2025
================
@@ -1372,6 +1372,50 @@ void VPlanTransforms::simplifyRecipes(VPlan &Plan) {
}
}
+static VPSingleDefRecipe *findHeaderMask(VPlan &Plan);
+
+/// Convert scatters with a uniform address that are either unmasked or
+/// masked by the header mask into an extract-last-element + scalar store.
+// TODO: Add a profitability check comparing the cost of a scatter vs.
+// extract + scalar store.
+static void optimizeScatterWithUniformAddr(VPlan &Plan) {
+ VPValue *HeaderMask = findHeaderMask(Plan);
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+ vp_depth_first_deep(Plan.getEntry()))) {
+ for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
+
+ // Only transform store recipes.
+ if (!isa<VPWidenStoreRecipe, VPWidenStoreEVLRecipe>(&R))
----------------
Mel-Chen wrote:
I think we only can handle VPWidenStoreRecipe before @fhahn's LastActiveLane patch is landed.
https://github.com/llvm/llvm-project/pull/166114
More information about the llvm-commits
mailing list