[llvm-commits] [llvm] r130428 -	/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    Benjamin Kramer 
    benny.kra at googlemail.com
       
    Thu Apr 28 14:40:13 PDT 2011
    
    
  
On 28.04.2011, at 22:20, Duncan Sands wrote:
> Hi Benjamin,
> 
>> -  // (trunc x) == C1&  (and x, CA) == C2 ->  (and CA|CMAX) == C1|C2
>> +  // (trunc x) == C1&  (and x, CA) == C2 ->  (and x, CA|CMAX) == C1|C2
>>    // where CMAX is the all ones value for the truncated type,
>>    // iff the lower bits of CA are zero.
> 
> don't you need the lower bits of C2 to also be zero?
> 
> Ciao,
> 
> Duncan.
> 
> PS: Of course, if they are not zero then "(and x, CA) == C2" can be folded to
> false, so probably you will never hit this in practice.
We do require the bits of C2 to be zero. This should be folded away earlier, however I was bitten
by this before, it's possible to create test cases where SimplifyDemandedBits hits the recursion
limit and doesn't fold things that should be folded, I'll add a check to be safe.
    
    
More information about the llvm-commits
mailing list