We can do this if Y*C doesn't overflow. This is trivial if C is
0/1. Otherwise we actually generate a mul instruction iff the div
has one use.
Alive2 Links:
udiv: https://alive2.llvm.org/ce/z/GWPW67 sdiv: https://alive2.llvm.org/ce/z/bUoX9h
Differential D150091
[InstCombine] Transform `icmp eq/ne ({su}div exact X,Y),C` -> `icmp eq/ne X, Y*C` goldstein.w.n on May 7 2023, 11:53 PM. Authored by
Details We can do this if Y*C doesn't overflow. This is trivial if C is Alive2 Links: udiv: https://alive2.llvm.org/ce/z/GWPW67 sdiv: https://alive2.llvm.org/ce/z/bUoX9h
Diff Detail
Event TimelineComment Actions I'd also suggest to update the proofs to match what you are actually implementing. The current ones are rather roundabout. |