summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-16 16:44:00 +0000
committerDan Gohman <gohman@apple.com>2008-09-16 16:44:00 +0000
commit793df075c999125cd1f26c69b43803bc61d5c12b (patch)
tree2c85ad4be30f764baa57a044e4a57c935d8d7a37
parent10dd39b1e810bf5b58c9cf9202663bafeadb1d84 (diff)
downloadllvm-793df075c999125cd1f26c69b43803bc61d5c12b.tar.gz
llvm-793df075c999125cd1f26c69b43803bc61d5c12b.tar.bz2
llvm-793df075c999125cd1f26c69b43803bc61d5c12b.tar.xz
FCmpInst predicates UNO, ORD, FALSE, and TRUE are commutative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56243 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Instructions.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 8ae9c375fb..272ccecfc4 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -807,16 +807,22 @@ public:
"Invalid operand types for FCmp instruction");
}
- /// This also tests for commutativity. If isEquality() returns true then
- /// the predicate is also commutative. Only the equality predicates are
- /// commutative.
/// @returns true if the predicate of this instruction is EQ or NE.
/// @brief Determine if this is an equality predicate.
bool isEquality() const {
return SubclassData == FCMP_OEQ || SubclassData == FCMP_ONE ||
SubclassData == FCMP_UEQ || SubclassData == FCMP_UNE;
}
- bool isCommutative() const { return isEquality(); }
+
+ /// @returns true if the predicate of this instruction is commutative.
+ /// @brief Determine if this is a commutative predicate.
+ bool isCommutative() const {
+ return isEquality() ||
+ SubclassData == FCMP_FALSE ||
+ SubclassData == FCMP_TRUE ||
+ SubclassData == FCMP_ORD ||
+ SubclassData == FCMP_UNO;
+ }
/// @returns true if the predicate is relational (not EQ or NE).
/// @brief Determine if this a relational predicate.