[llvm-commits] [llvm] r131860 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp test/Transforms/InstCombine/div.ll

Chris Lattner clattner at apple.com
Sun May 22 17:15:30 PDT 2011


On May 22, 2011, at 12:17 PM, Duncan Sands wrote:

>> +  // Because V cannot be zero, we know that B is less than A.
>> +  Value *A = 0, *B = 0; ConstantInt *One = 0;
>> +  if (match(V, m_LShr(m_OneUse(m_Shl(m_ConstantInt(One), m_Value(A))),
>> +                      m_Value(B)))&&
>> +      // The "1" can be any value known to be a power of 2.
>> +      One->getValue().isPowerOf2()) {
> 
> ValueTracking has a isPowerOfTwo method which can also tell that some
> non-constant expressions are powers of two.

Ah, that's where it is, thanks!  I knew it lives somewhere but couldn't remember where.  Fixed in r131885.

-Chris



More information about the llvm-commits mailing list