[llvm] [InstCombine] fold `gepi _, (srem x, y)` to `gepi _, (urem x, y)` if `y` is power-of-2 (PR #180148)

via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 8 23:15:24 PST 2026


================
@@ -3347,6 +3347,26 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
     }
   }
 
+  // srem -> (and/urem) for inbounds+nuw GEP
+  if (Indices.size() == 1 && GEP.isInBounds() && GEP.hasNoUnsignedWrap()) {
----------------
imkiva wrote:

Thanks. Fixed accordingly

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


More information about the llvm-commits mailing list