RKSimon wrote: Why aren't we just trying to move most of the getInstructionCost shuffle logic into improveShuffleKindFromMask? iirc it can be overridden via CRTP if a target need to, https://github.com/llvm/llvm-project/pull/145373