[InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.

llvm-svn: 325003
This commit is contained in:
Simon Pilgrim 2018-02-13 13:16:26 +00:00
parent 6c69732c05
commit be0dd72620
1 changed files with 2 additions and 3 deletions

View File

@ -102,9 +102,8 @@ static Value *simplifyValueKnownNonZero(Value *V, InstCombiner &IC,
/// Return a null pointer otherwise.
static Constant *getLogBase2(Type *Ty, Constant *C) {
const APInt *IVal;
if (const auto *CI = dyn_cast<ConstantInt>(C))
if (match(CI, m_APInt(IVal)) && IVal->isPowerOf2())
return ConstantInt::get(Ty, IVal->logBase2());
if (match(C, m_APInt(IVal)) && IVal->isPowerOf2())
return ConstantInt::get(Ty, IVal->logBase2());
if (!Ty->isVectorTy())
return nullptr;