topperc wrote: Have you investigated doing this as a DAGCombine after legalization? Its very unusual to change type legalization behavior based on surrounding instructions. https://github.com/llvm/llvm-project/pull/99591