[llvm] [RISCV][TTI] Return invalid for getCastInstrCost w/vector split. (PR #221913)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 04:17:23 PDT 2026


================
@@ -1925,6 +1931,12 @@ InstructionCost RISCVTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
   std::pair<InstructionCost, MVT> SrcLT = getTypeLegalizationCost(Src);
   std::pair<InstructionCost, MVT> DstLT = getTypeLegalizationCost(Dst);
 
+  // Currently VLOptimizer cannot inference the VL properly when vector splits.
+  // TODO: Remove this constraint when VLOptimizer can optimize this.
----------------
lukel97 wrote:

I don't think this should be a TODO as I don't think there's going to be a performant way to optimise this with VLOptimizer. Even if we analyzed that a vl is coming from a split vector we would still end up with lots of vsetvli toggles because the high and low parts of the split vector would have different AVLs.

I would just reword this as "avoid vectors that would be split as they introduce vsetvli toggles"

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


More information about the llvm-commits mailing list