// fma fneg(x), fneg(y), z -> fma x, y, z
if (match(Src0, m_FNeg(m_Value(LHS))) &&
match(Src1, m_FNeg(m_Value(RHS)))) {
- CallInst *NewCall = Builder->CreateCall(II->getCalledFunction(),
- {LHS, RHS, II->getArgOperand(2)});
- NewCall->takeName(II);
- NewCall->copyFastMathFlags(II);
- return replaceInstUsesWith(*II, NewCall);
+ II->setArgOperand(0, LHS);
+ II->setArgOperand(1, RHS);
+ return II;
}
// fma fabs(x), fabs(x), z -> fma x, x, z
if (match(Src0, m_Intrinsic<Intrinsic::fabs>(m_Value(LHS))) &&
match(Src1, m_Intrinsic<Intrinsic::fabs>(m_Value(RHS))) && LHS == RHS) {
- CallInst *NewCall = Builder->CreateCall(II->getCalledFunction(),
- {LHS, LHS, II->getArgOperand(2)});
- NewCall->takeName(II);
- NewCall->copyFastMathFlags(II);
- return replaceInstUsesWith(*II, NewCall);
+ II->setArgOperand(0, LHS);
+ II->setArgOperand(1, RHS);
+ return II;
}
// fma x, 1, z -> fadd x, z