From 51de22c8ee6578bf7ae126913d4b24b5cf08ef7c Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 11 Sep 2019 16:17:03 +0000 Subject: Revert [InstCombine] Use SimplifyFMulInst to simplify multiply in fma. This introduces additional rounding error in some cases. See D67434. This reverts r371518 (git commit 18a1f0818b659cee13865b4fad2648d85984a4ed) llvm-svn: 371634 --- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp') diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 1cef8d956b7..e96e45e802a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2258,11 +2258,9 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return II; } - // Try to simplify the underlying FMul. - if (Value *V = SimplifyFMulInst(II->getArgOperand(0), II->getArgOperand(1), - II->getFastMathFlags(), - SQ.getWithInstruction(II))) { - auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2)); + // fma x, 1, z -> fadd x, z + if (match(Src1, m_FPOne())) { + auto *FAdd = BinaryOperator::CreateFAdd(Src0, II->getArgOperand(2)); FAdd->copyFastMathFlags(II); return FAdd; } -- cgit v1.2.3