[llvm] Fold (a % b) lt/ge (b-1) where b is a power of 2 (PR #72504)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 04:10:43 PST 2023


nikic wrote:

> As far as I can tell, this transform doesn't actually require a power of two? We only need to be careful about the sign. https://alive2.llvm.org/ce/z/AJq3Ch

Just to be clear, I'm viewing this in terms of folding an inequality predicate into an equality predicate. Once we have an equality comparison, it will be converted into a mask check for powers of two by an existing transform.

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


More information about the llvm-commits mailing list