[llvm] d4f70d6 - [IR] CmpInst: add isRelational()
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 6 00:31:48 PST 2020
Author: Roman Lebedev
Date: 2020-11-06T11:31:09+03:00
New Revision: d4f70d64547a1cf9a39e29dc4b70e53158df49fb
URL: https://github.com/llvm/llvm-project/commit/d4f70d64547a1cf9a39e29dc4b70e53158df49fb
DIFF: https://github.com/llvm/llvm-project/commit/d4f70d64547a1cf9a39e29dc4b70e53158df49fb.diff
LOG: [IR] CmpInst: add isRelational()
Since there's CmpInst::isEquality(), it only makes sense
to have it's inverse for consistency.
Added:
Modified:
llvm/include/llvm/IR/InstrTypes.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 563b9d99b4f2..27575487e7ab 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -899,6 +899,12 @@ class CmpInst : public Instruction {
/// 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 {
More information about the llvm-commits
mailing list