[llvm] [VPlan] Introduces explicit broadcast for live-in constants. (PR #133213)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 02:25:39 PDT 2025
https://github.com/fhahn commented:
Explicitly materializing broadcasts for all constant seems to go from one extreme to another: from assuming materializing constants is (almost) free to assuming all need to be explicitly materialized outside the loop.
I am worried that this modeling isn't accurate and makes things worse, as in many cases were constants can be materialized for in the loop with low cost w/o increasing register pressure across the whole loop or can be folded into instructions. I think it is very difficult to model this accurately in VPlan.
IIUC if we understimate the pressure, in the worst case we end up with additional materialization code for constants in the loop body, and if we overstimate the cost we may not vectorize at all or with a lower VF.
Is there a real-world use case where you see improvements with considering register pressure of constants?
One thing we probably don't account for correctly at the moment in the register pressure computation is that for constant-materialization, we need at enough unused registers for the max number of uses of constant at a single recipe.
https://github.com/llvm/llvm-project/pull/133213
More information about the llvm-commits
mailing list