[llvm] [LLVM][SelectionDAG] Don't legalise splat constants until required. (PR #143571)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 07:41:16 PDT 2025


preames wrote:

> > @paulwalker-arm I think I'm missing the bigger picture of why the ConstantInt change affects SelectionDAG. Is SelectionDAG going to use ConstantSDNode instead of SPLAT_VECTOR for constant splats?
> 
> SPLAT_VECTOR already does a good job of unifying the necessary code paths so I've no plans to change ConstantSDNode.
> 
> The connection is when building the initial DAG. When using ConstantInt vector constants SelectionDAGBuilder can bypass the current shuffle logic and call straight into `SelectionDAG::getConstant()`. This results in all vector constants being legalised during initial construction causing us to miss out on various combines, whereas the existing path would only legalise vector constants created after the initial DAG constructions.

Slightly ugly, but can you write a check which identifies the constants which used to go down the shuffle path and force them to continue doing so for now?  We'd want to come back to this, but that would let you split the work and make forward progress.  

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


More information about the llvm-commits mailing list