[CVP] Expand bound `urem`s
This kind of thing happens really frequently in LLVM's very own shuffle combining methods, and it is even considered bad practice to use `%` there, instead of using this expansion directly. Though, many of the cases there have variable divisors, so this won't help everything. Simple case: https://alive2.llvm.org/ce/z/PjvYf- There's alternative expansion via `umin`: https://alive2.llvm.org/ce/z/hWCVPb BUT while we can transform the first expansion into the `umin` one (e.g. for SCEV): https://alive2.llvm.org/ce/z/iNxKmJ ... we can't go in the opposite direction. Also, the non-`umin` expansion seems somewhat more codegen-friendly: https://godbolt.org/z/qzjx5bqWK https://godbolt.org/z/a7bj1axbx There's second variant of precondition: https://alive2.llvm.org/ce/z/zE6cbM but there the numerator must be non-undef / must be frozen.
Loading
Please sign in to comment