[IR] CmpInst: add isRelational()
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 6 Nov 2020 07:40:25 +0000 (10:40 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 6 Nov 2020 08:31:09 +0000 (11:31 +0300)
Since there's CmpInst::isEquality(), it only makes sense
to have it's inverse for consistency.

llvm/include/llvm/IR/InstrTypes.h

index 563b9d9..2757548 100644 (file)
@@ -899,6 +899,12 @@ public:
   /// Determine if this is an equals/not equals predicate.
   bool isEquality() const { return isEquality(getPredicate()); }
 
+  /// Return true if the predicate is relational (not EQ or NE).
+  static bool isRelational(Predicate P) { return !isEquality(P); }
+
+  /// Return true if the predicate is relational (not EQ or NE).
+  bool isRelational() const { return !isEquality(); }
+
   /// @returns true if the comparison is signed, false otherwise.
   /// Determine if this instruction is using a signed comparison.
   bool isSigned() const {