[llvm] r345904 - [IR] remove fake binop query for fneg

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 15:56:15 PDT 2018


Author: spatel
Date: Thu Nov  1 15:56:15 2018
New Revision: 345904

URL: http://llvm.org/viewvc/llvm-project?rev=345904&view=rev
Log:
[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


Modified:
    llvm/trunk/include/llvm/IR/InstrTypes.h
    llvm/trunk/lib/IR/Instructions.cpp

Modified: llvm/trunk/include/llvm/IR/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InstrTypes.h?rev=345904&r1=345903&r2=345904&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/IR/InstrTypes.h Thu Nov  1 15:56:15 2018
@@ -308,13 +308,6 @@ public:
   static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
                                    BasicBlock *InsertAtEnd);
 
-  /// Check if the given Value is an FNeg instruction.
-  static bool isFNeg(const Value *V, bool IgnoreZeroSign=false);
-
-  /// Helper functions to extract the unary argument of an FNeg.
-  static const Value *getFNegArgument(const Value *BinOp);
-  static       Value *getFNegArgument(      Value *BinOp);
-
   BinaryOps getOpcode() const {
     return static_cast<BinaryOps>(Instruction::getOpcode());
   }

Modified: llvm/trunk/lib/IR/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Instructions.cpp?rev=345904&r1=345903&r2=345904&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Instructions.cpp (original)
+++ llvm/trunk/lib/IR/Instructions.cpp Thu Nov  1 15:56:15 2018
@@ -2109,25 +2109,6 @@ BinaryOperator *BinaryOperator::CreateNo
                             Op->getType(), Name, InsertAtEnd);
 }
 
-bool BinaryOperator::isFNeg(const Value *V, bool IgnoreZeroSign) {
-  if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
-    if (Bop->getOpcode() == Instruction::FSub)
-      if (Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
-        if (!IgnoreZeroSign)
-          IgnoreZeroSign = cast<Instruction>(V)->hasNoSignedZeros();
-        return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
-      }
-  return false;
-}
-
-Value *BinaryOperator::getFNegArgument(Value *BinOp) {
-  return cast<BinaryOperator>(BinOp)->getOperand(1);
-}
-
-const Value *BinaryOperator::getFNegArgument(const Value *BinOp) {
-  return getFNegArgument(const_cast<Value*>(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




More information about the llvm-commits mailing list