summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index f61d82340b5..2fcd003bcbd 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -425,17 +425,15 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
if (Instruction *NV = FoldOpIntoPhi(I))
return NV;
- ConstantFP *C = dyn_cast<ConstantFP>(Op1);
-
// (fmul X, -1.0) --> (fsub -0.0, X)
- if (C && C->isExactlyValue(-1.0)) {
- Instruction *RI = BinaryOperator::CreateFSub(
- ConstantFP::getNegativeZero(C->getType()),
- Op0);
+ if (match(Op1, m_SpecificFP(-1.0))) {
+ Constant *NegZero = ConstantFP::getNegativeZero(Op1->getType());
+ Instruction *RI = BinaryOperator::CreateFSub(NegZero, Op0);
RI->copyFastMathFlags(&I);
return RI;
}
+ ConstantFP *C = dyn_cast<ConstantFP>(Op1);
if (C && AllowReassociate && C->getValueAPF().isFiniteNonZero()) {
// Let MDC denote an expression in one of these forms:
// X * C, C/X, X/C, where C is a constant.
OpenPOWER on IntegriCloud