diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-04-05 13:24:26 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-04-05 13:24:26 +0000 |
commit | 236442e06374f295648f805c23cb7aaeda35940c (patch) | |
tree | a32e418cc11faeb77ab078850e41b9c8ed1f72fa | |
parent | 57225ac179d3a12ab0a23c247bbf0ee0e257f741 (diff) | |
download | bcm5719-llvm-236442e06374f295648f805c23cb7aaeda35940c.tar.gz bcm5719-llvm-236442e06374f295648f805c23cb7aaeda35940c.zip |
[InstCombine] cleanup; NFC
llvm-svn: 329282
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 31fbaa7a6e2..e545cc27a70 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -2016,37 +2016,34 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { Value *Src0 = II->getArgOperand(0); Value *Src1 = II->getArgOperand(1); - // Canonicalize constants into the RHS. + // Canonicalize constant multiply operand to Src1. if (isa<Constant>(Src0) && !isa<Constant>(Src1)) { II->setArgOperand(0, Src1); II->setArgOperand(1, Src0); std::swap(Src0, Src1); } - Value *LHS = nullptr; - Value *RHS = nullptr; - // 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)))) { - II->setArgOperand(0, LHS); - II->setArgOperand(1, RHS); + Value *X, *Y; + if (match(Src0, m_FNeg(m_Value(X))) && match(Src1, m_FNeg(m_Value(Y)))) { + II->setArgOperand(0, X); + II->setArgOperand(1, Y); 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) { - II->setArgOperand(0, LHS); - II->setArgOperand(1, RHS); + if (match(Src0, m_Intrinsic<Intrinsic::fabs>(m_Value(X))) && + match(Src1, m_Intrinsic<Intrinsic::fabs>(m_Specific(X)))) { + II->setArgOperand(0, X); + II->setArgOperand(1, X); return II; } // fma x, 1, z -> fadd x, z if (match(Src1, m_FPOne())) { - Instruction *RI = BinaryOperator::CreateFAdd(Src0, II->getArgOperand(2)); - RI->copyFastMathFlags(II); - return RI; + auto *FAdd = BinaryOperator::CreateFAdd(Src0, II->getArgOperand(2)); + FAdd->copyFastMathFlags(II); + return FAdd; } break; |