https://github.com/lukel97 approved this pull request. LGTM, thanks! If you're looking for a follow up PR, I think the i64 sra/srl patterns can get the same optimisation too right? https://github.com/llvm/llvm-project/pull/152397