llvm.org GIT mirror llvm / 9efe2bc
[InstCombine] reduce code for fadd with fneg operand; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367224 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 1 year, 17 days ago
1 changed file(s) with 4 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
13811381 if (Instruction *FoldedFAdd = foldBinOpIntoSelectOrPhi(I))
13821382 return FoldedFAdd;
13831383
1384 Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
1385 Value *X;
13861384 // (-X) + Y --> Y - X
1387 if (match(LHS, m_FNeg(m_Value(X))))
1388 return BinaryOperator::CreateFSubFMF(RHS, X, &I);
1389 // Y + (-X) --> Y - X
1390 if (match(RHS, m_FNeg(m_Value(X))))
1391 return BinaryOperator::CreateFSubFMF(LHS, X, &I);
1385 Value *X, *Y;
1386 if (match(&I, m_c_FAdd(m_FNeg(m_Value(X)), m_Value(Y))))
1387 return BinaryOperator::CreateFSubFMF(Y, X, &I);
13921388
13931389 // Check for (fadd double (sitofp x), y), see if we can merge this into an
13941390 // integer add followed by a promotion.
1391 Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
13951392 if (SIToFPInst *LHSConv = dyn_cast(LHS)) {
13961393 Value *LHSIntVal = LHSConv->getOperand(0);
13971394 Type *FPType = LHSConv->getType();