[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:53 PST 2025


https://github.com/Mel-Chen commented:

We can implement it in SimplifyRecipes:
Add a static function `static void simplifyRecipe(VPWidenMemoryRecipe *Mem, VPTypeAnalysis &TypeInfo);`

And modify VPlanTransforms::simplifyRecipes to:

```
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
  for (VPRecipeBase &R : make_early_inc_range(*VPBB))
    if (auto *Def = dyn_cast<VPSingleDefRecipe>(&R))
      simplifyRecipe(Def, TypeInfo);
    else if (auto *Mem = dyn_cast<VPWidenMemoryRecipe>(&R))
      simplifyRecipe(Mem, TypeInfo);
}
```
Although overloading would work, I think having a visitor would be better. https://github.com/llvm/llvm-project/pull/165568#discussion_r2476876204

Regarding sinking, I’m working on sinking recipes without in-loop users for bzip2. It should be applied after licm. Eventually, we can sink scalar stores out of the vectorized loop together.

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


More information about the llvm-commits mailing list