[NFC] Add some new util functions to ICmpInst
authorMax Kazantsev <mkazantsev@azul.com>
Thu, 29 Oct 2020 10:34:58 +0000 (17:34 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Thu, 29 Oct 2020 10:38:11 +0000 (17:38 +0700)
llvm/include/llvm/IR/Instructions.h

index 7b41dce..ea1a60d 100644 (file)
@@ -1290,6 +1290,30 @@ public:
     return !isEquality(P);
   }
 
+  /// Return true if the predicate is SGT or UGT.
+  ///
+  static bool isGT(Predicate P) {
+    return P == ICMP_SGT || P == ICMP_UGT;
+  }
+
+  /// Return true if the predicate is SLT or ULT.
+  ///
+  static bool isLT(Predicate P) {
+    return P == ICMP_SLT || P == ICMP_ULT;
+  }
+
+  /// Return true if the predicate is SGE or UGE.
+  ///
+  static bool isGE(Predicate P) {
+    return P == ICMP_SGE || P == ICMP_UGE;
+  }
+
+  /// Return true if the predicate is SLE or ULE.
+  ///
+  static bool isLE(Predicate P) {
+    return P == ICMP_SLE || P == ICMP_ULE;
+  }
+
   /// Exchange the two operands to this instruction in such a way that it does
   /// not modify the semantics of the instruction. The predicate value may be
   /// changed to retain the same result if the predicate is order dependent