[llvm] r325141 - [InstCombine] replace isa/cast with dyn_cast; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 08:56:44 PST 2018
Author: spatel
Date: Wed Feb 14 08:56:44 2018
New Revision: 325141
URL: http://llvm.org/viewvc/llvm-project?rev=325141&view=rev
Log:
[InstCombine] replace isa/cast with dyn_cast; NFC
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=325141&r1=325140&r2=325141&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp Wed Feb 14 08:56:44 2018
@@ -596,19 +596,18 @@ Instruction *InstCombiner::visitFMul(Bin
bool AllowReassociate = I.isFast();
// Simplify mul instructions with a constant RHS.
- if (isa<Constant>(Op1)) {
+ if (auto *C = dyn_cast<Constant>(Op1)) {
if (Instruction *FoldedMul = foldOpWithConstantIntoOperand(I))
return FoldedMul;
// (fmul X, -1.0) --> (fsub -0.0, X)
- if (match(Op1, m_SpecificFP(-1.0))) {
+ if (match(C, m_SpecificFP(-1.0))) {
Constant *NegZero = ConstantFP::getNegativeZero(Op1->getType());
Instruction *RI = BinaryOperator::CreateFSub(NegZero, Op0);
RI->copyFastMathFlags(&I);
return RI;
}
- Constant *C = cast<Constant>(Op1);
if (AllowReassociate && isFiniteNonZeroFp(C)) {
// Let MDC denote an expression in one of these forms:
// X * C, C/X, X/C, where C is a constant.
More information about the llvm-commits
mailing list