diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h index e42bfc3afce0..4487768e6c6f 100644 --- a/llvm/include/llvm/IR/InstrTypes.h +++ b/llvm/include/llvm/IR/InstrTypes.h @@ -308,21 +308,12 @@ public: static BinaryOperator *CreateNot(Value *Op, const Twine &Name, BasicBlock *InsertAtEnd); - /// Check if the given Value is a NEG, FNeg, or NOT instruction. - /// - static bool isNeg(const Value *V); + /// Check if the given Value is an FNeg instruction. static bool isFNeg(const Value *V, bool IgnoreZeroSign=false); - static bool isNot(const Value *V); - /// Helper functions to extract the unary argument of a NEG, FNEG or NOT - /// operation implemented via Sub, FSub, or Xor. - /// - static const Value *getNegArgument(const Value *BinOp); - static Value *getNegArgument( Value *BinOp); + /// Helper functions to extract the unary argument of an FNeg. static const Value *getFNegArgument(const Value *BinOp); static Value *getFNegArgument( Value *BinOp); - static const Value *getNotArgument(const Value *BinOp); - static Value *getNotArgument( Value *BinOp); BinaryOps getOpcode() const { return static_cast(Instruction::getOpcode()); diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index e1d1c0f2a6b2..2a188b77679c 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2116,14 +2116,6 @@ static inline bool isConstantAllOnes(const Value *V) { return false; } -bool BinaryOperator::isNeg(const Value *V) { - if (const BinaryOperator *Bop = dyn_cast(V)) - if (Bop->getOpcode() == Instruction::Sub) - if (Constant *C = dyn_cast(Bop->getOperand(0))) - return C->isNegativeZeroValue(); - return false; -} - bool BinaryOperator::isFNeg(const Value *V, bool IgnoreZeroSign) { if (const BinaryOperator *Bop = dyn_cast(V)) if (Bop->getOpcode() == Instruction::FSub) @@ -2135,22 +2127,6 @@ bool BinaryOperator::isFNeg(const Value *V, bool IgnoreZeroSign) { return false; } -bool BinaryOperator::isNot(const Value *V) { - if (const BinaryOperator *Bop = dyn_cast(V)) - return (Bop->getOpcode() == Instruction::Xor && - (isConstantAllOnes(Bop->getOperand(1)) || - isConstantAllOnes(Bop->getOperand(0)))); - return false; -} - -Value *BinaryOperator::getNegArgument(Value *BinOp) { - return cast(BinOp)->getOperand(1); -} - -const Value *BinaryOperator::getNegArgument(const Value *BinOp) { - return getNegArgument(const_cast(BinOp)); -} - Value *BinaryOperator::getFNegArgument(Value *BinOp) { return cast(BinOp)->getOperand(1); } @@ -2159,21 +2135,6 @@ const Value *BinaryOperator::getFNegArgument(const Value *BinOp) { return getFNegArgument(const_cast(BinOp)); } -Value *BinaryOperator::getNotArgument(Value *BinOp) { - assert(isNot(BinOp) && "getNotArgument on non-'not' instruction!"); - BinaryOperator *BO = cast(BinOp); - Value *Op0 = BO->getOperand(0); - Value *Op1 = BO->getOperand(1); - if (isConstantAllOnes(Op0)) return Op1; - - assert(isConstantAllOnes(Op1)); - return Op0; -} - -const Value *BinaryOperator::getNotArgument(const Value *BinOp) { - return getNotArgument(const_cast(BinOp)); -} - // Exchange the two operands to this instruction. This instruction is safe to // use on any binary instruction and does not modify the semantics of the // instruction. If the instruction is order-dependent (SetLT f.e.), the opcode