https://github.com/arsenm approved this pull request. Curiously GlobalISel seems to already have this: https://github.com/llvm/llvm-project/blob/1e7d047c71ce0a8076f774b9106cd7a499a1c542/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp#L2458 https://github.com/llvm/llvm-project/pull/92514