[llvm] [RISCV] Check the legality of source vector types in matchSplatAsGather (PR #133028)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 25 22:44:35 PDT 2025


topperc wrote:

> I thought matchSplatAsGather was only supposed to be run with all types legal. Maybe the best place to fix this would be in performDAGCombine?
> 
> https://github.com/llvm/llvm-project/blob/5d0c18e489f9919342911d2443d1847deb3d3204/llvm/lib/Target/RISCV/RISCVISelLowering.cpp#L19133-L19142
> 
> Can we replace the `!isTypeLegal(VT)` with `DCI.isBeforeLegalize()`? I presume that would also cover the source type being illegal.

I'm not sure if that's a good idea. If no types are legalized, there isn't a DAGCombine run after the type legalizer. We'll go straight to LegalizeVectorOps. This would mean the optimization won't run at all before LegalizeVectorOps if all types are legal.

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


More information about the llvm-commits mailing list