We already did (X & C2) > C1 --> (X & C2) != 0, if any bit set in (X & C2) will produce a result greater than C1. But there is an equivalent inverse condition with <= C1 (which will be canonicalized to < C1+1)
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
LGTM. The bit-logic looks right to me - but I miss Alive. :)
cc @nlopes
See inline for some nits.
lib/Transforms/InstCombine/InstCombineCompares.cpp | ||
---|---|---|
1720 | Is this is a weird way of asking: !C2->isNullValue() ? | |
1722 | The change to use getActiveBits() could be an NFC commit before this patch. | |
test/Transforms/InstCombine/icmp.ll | ||
1141 | Would be nice to have a test that uses constants at/near the limits. Something like: %and = and i8 %x, -128 %cmp = icmp ult i8 %and, 126 ret i1 %cmp } Could use vectors to add more testing diversity...assuming that works. |
Is this is a weird way of asking: !C2->isNullValue() ?