mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[InstCombine] cleanup; NFC
llvm-svn: 329282
This commit is contained in:
parent
ae3b946d06
commit
d83d832759
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user