[llvm] [LV] Fix MVE regression from #132190 (PR #141736)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 02:09:56 PDT 2025


https://github.com/sdesmalen-arm commented:

#132190 changed the behaviour such that VFs are pruned based on reg-usage regardless of whether maximize-vector-bandwidth is enabled. This means it now applies to more cases and exposes pre-existing bugs in the reg-usage computation. While I understand the rationale behind rolling back to previous behaviour, my concern is that this PR hides these bugs again rather than fixing them.

That being said, it could be that the registers pressure estimation is too coarse to be useful for the general case (i.e. non-maximized bandwidth VFs). If that is the consensus, then I think this PR should limit pruning to *only* those VFs that are added by maximize vector bandwidth.

For the test added in this PR, what I can see is that the reason the regusage is too high is because for a VF of 4 it tries to vectorise the stores (rather than scalarise them as happens for VF=2). This inserts a `VPWidenPointerInductionRecipe` for the pointer at the start of the block which is then used by the stores at the end of the block, increasing register pressure for vector registers. In practice, the code-generator will try to instantiate the widened (vector) induction pointer closer to its use, rather than at the start of the block. I think we can consider these values as 'scalar' (similar to what we do for e.g. `VPReplicateRecipe`) because they'll remain scalar until they have to be widened at the point of their use.

@SamTebbs33 and @fhah what do you think?

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


More information about the llvm-commits mailing list