If C is a high-bit mask:
(trunc X) u< C --> (X & C) != C (are any masked-high-bits clear?)
This extends the fold added with:
acabad9ff6bf (https://alive2.llvm.org/ce/z/aFr7qV)
We discussed using decomposeBitTestICmp() to generalize this, but that function doesn't line up with the other fold that I was imagining (maybe there's some way to adapt/invert the logic?).
This patch also modifies the code to create the mask constant from the earlier patch in an attempt to make the bit-masking relationships clearer. I can make that an NFC pre-commit to be safer.
Here are Alive2 generalizations the folds:
https://alive2.llvm.org/ce/z/u-ZpC_ (the previous patch)
https://alive2.llvm.org/ce/z/YsuAu2 (ult this patch)
https://alive2.llvm.org/ce/z/ekktQP (ugt low bitmask)
https://alive2.llvm.org/ce/z/pJY9wR (ugt one clear bit)
This is an opposing transform if we use decomposeBitMask to make this patch more general.
This was added with:
dfa3b0954145ec6