[llvm-commits] [llvm] r53452 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Nick Lewycky nicholas at mxc.ca
Fri Jul 11 21:00:08 PDT 2008


Duncan Sands wrote:
> Hi Nick,
> 
>> +            // a * Cst icmp eq/ne b * Cst --> a & Mask icmp b & Mask
> 
> try a=4, b=0 and Cst=3 with i8 arithmetic.

Duncan and I met on IRC to discuss this one, and we agreed that the 
transform is correct. The mask calculation is about figuring out how 
many times the top bits would be lost due to overflow (which is zero, 
for any Cst where the low bit is one).

Cst=3 causes Mask = -1 which is a non-mask, hence it becomes a * 3 icmp 
b * 3 --> a icmp b, which is correct.

Nick





More information about the llvm-commits mailing list