[llvm] [InstCombine] fold `gepi _, (srem x, y)` to `gepi _, (urem x, y)` if `y` is power-of-2 (PR #180148)
Simonas Kazlauskas via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 9 08:30:21 PST 2026
nagisa wrote:
> Looks like we can always convert srem x, pow2 to urem if we can prove the result is non-negative
Correct, but I could not come up with any other sequence of instructions where this sort of proof would come up naturally without assumes. I tried various `nuw` tagged arithmetics for example and alive wasn't happy with it. gepi was my direct use-case so I went with that. If there's a more general way to match the same requirements, it would be even better ig.
https://github.com/llvm/llvm-project/pull/180148
More information about the llvm-commits
mailing list