[llvm] 79c5b4c - [NFC] Add some new util functions to ICmpInst
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 29 03:38:30 PDT 2020
Author: Max Kazantsev
Date: 2020-10-29T17:38:11+07:00
New Revision: 79c5b4c546bb528bd51003a10f0a5aecab74ffbe
URL: https://github.com/llvm/llvm-project/commit/79c5b4c546bb528bd51003a10f0a5aecab74ffbe
DIFF: https://github.com/llvm/llvm-project/commit/79c5b4c546bb528bd51003a10f0a5aecab74ffbe.diff
LOG: [NFC] Add some new util functions to ICmpInst
Added:
Modified:
llvm/include/llvm/IR/Instructions.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 7b41dced564d..ea1a60d52c87 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1290,6 +1290,30 @@ class ICmpInst: public CmpInst {
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
More information about the llvm-commits
mailing list