[llvm-commits] [llvm] r56243 - /llvm/trunk/include/llvm/Instructions.h

Dan Gohman gohman at apple.com
Tue Sep 16 09:44:05 PDT 2008


Author: djg
Date: Tue Sep 16 11:44:00 2008
New Revision: 56243

URL: http://llvm.org/viewvc/llvm-project?rev=56243&view=rev
Log:
FCmpInst predicates UNO, ORD, FALSE, and TRUE are commutative.

Modified:
    llvm/trunk/include/llvm/Instructions.h

Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=56243&r1=56242&r2=56243&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Sep 16 11:44:00 2008
@@ -807,16 +807,22 @@
            "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.





More information about the llvm-commits mailing list