[llvm-commits] [llvm] r122248 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp test/Transforms/InstCombine/or.ll

Benjamin Kramer benny.kra at googlemail.com
Mon Dec 20 12:17:35 PST 2010

On 20.12.2010, at 19:13, Frits van Bommel wrote:

> On Mon, Dec 20, 2010 at 5:18 PM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Teach InstCombine to merge (icmp ult (X + CA), C1) | (icmp eq X, C2) into (icmp ult (X + CA), C1 + 1) if C2 + CA == C1.
> Shouldn't it turn it into (icmp ule (X + CA), C1), to guard against
> the case where C1 + 1 overflows? (i.e. C1 is the maximum unsigned
> value, aka -1)

fixed. Thanks for spotting this.

> And does this already happen for predicates other than ult? (e.g. slt,
> sgt, ugt, ...)

No, the transformation should be generalized somehow, the commuted variant isn't caught either. It'll need some more thought though, I don't want to duplicate this code 8 times.

More information about the llvm-commits mailing list