summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2017-01-10 23:17:52 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2017-01-10 23:17:52 +0000
commit3f509042b0cc4ec189585c59da87936d7c259501 (patch)
tree4864e82e1b9b90a580a24983ebacfb316dd78c93 /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
parentfdb78f8baee78909c8003d5dff92dee76d50c6d0 (diff)
downloadbcm5719-llvm-3f509042b0cc4ec189585c59da87936d7c259501.tar.gz
bcm5719-llvm-3f509042b0cc4ec189585c59da87936d7c259501.zip
InstCombine: Set operands instead of creating new call
llvm-svn: 291612
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index b29ed3c8745..d51d3687ea3 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1599,21 +1599,17 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
// 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
OpenPOWER on IntegriCloud