llvm.org GIT mirror llvm / c429a87
[IR] remove fake binop query for fneg We want to remove this fneg API because it would silently fail if we add an actual fneg instruction to IR (as proposed in D53877 ). We have a newer 'match' API that makes checking for these patterns simpler. It also works with vectors that may include undef elements in constants. If any out-of-tree users need updating, they can model their code changes on this commit: https://reviews.llvm.org/rL345295 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345904 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 1 year, 20 days ago
2 changed file(s) with 0 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
306306 Instruction *InsertBefore = nullptr);
307307 static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
308308 BasicBlock *InsertAtEnd);
309
310 /// Check if the given Value is an FNeg instruction.
311 static bool isFNeg(const Value *V, bool IgnoreZeroSign=false);
312
313 /// Helper functions to extract the unary argument of an FNeg.
314 static const Value *getFNegArgument(const Value *BinOp);
315 static Value *getFNegArgument( Value *BinOp);
316309
317310 BinaryOps getOpcode() const {
318311 return static_cast(Instruction::getOpcode());
21062106 Constant *AllOnes = Constant::getAllOnesValue(Op->getType());
21072107 return new BinaryOperator(Instruction::Xor, Op, AllOnes,
21082108 Op->getType(), Name, InsertAtEnd);
2109 }
2110
2111 bool BinaryOperator::isFNeg(const Value *V, bool IgnoreZeroSign) {
2112 if (const BinaryOperator *Bop = dyn_cast(V))
2113 if (Bop->getOpcode() == Instruction::FSub)
2114 if (Constant *C = dyn_cast(Bop->getOperand(0))) {
2115 if (!IgnoreZeroSign)
2116 IgnoreZeroSign = cast(V)->hasNoSignedZeros();
2117 return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
2118 }
2119 return false;
2120 }
2121
2122 Value *BinaryOperator::getFNegArgument(Value *BinOp) {
2123 return cast(BinOp)->getOperand(1);
2124 }
2125
2126 const Value *BinaryOperator::getFNegArgument(const Value *BinOp) {
2127 return getFNegArgument(const_cast(BinOp));
21282109 }
21292110
21302111 // Exchange the two operands to this instruction. This instruction is safe to