[llvm] r325003 - [InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 05:16:26 PST 2018
Author: rksimon
Date: Tue Feb 13 05:16:26 2018
New Revision: 325003
URL: http://llvm.org/viewvc/llvm-project?rev=325003&view=rev
Log:
[InstCombine] Simplify getLogBase2 case for scalar/splats. NFCI.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp?rev=325003&r1=325002&r2=325003&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Tue Feb 13 05:16:26 2018
@@ -102,9 +102,8 @@ static Value *simplifyValueKnownNonZero(
/// 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;
More information about the llvm-commits
mailing list