[InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Feb 2018 13:16:26 +0000 (13:16 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 13 Feb 2018 13:16:26 +0000 (13:16 +0000)
llvm-svn: 325003

llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

index b1cad6b..7654c34 100644 (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;