FCmpInst predicates UNO, ORD, FALSE, and TRUE are commutative.
authorDan Gohman <gohman@apple.com>
Tue, 16 Sep 2008 16:44:00 +0000 (16:44 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 16 Sep 2008 16:44:00 +0000 (16:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56243 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instructions.h

index 8ae9c375fb7d20bd991842010017983d746f3cf0..272ccecfc418bf64f4571c5adcd5137a9f963f2c 100644 (file)
@@ -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.