[llvm-commits] CVS: llvm/include/llvm/Constants.h

Reid Spencer reid at x10sys.com
Thu Mar 1 16:27:34 PST 2007



Changes in directory llvm/include/llvm:

Constants.h updated: 1.137 -> 1.138
---
Log message:

Add a non-virtual test for zero, isZero, and rename isUnitValue isOne. 
These will be used in upcoming patches to avoid virtual function call when
the client knows it is a ConstantInt.


---
Diffs of the changes:  (+10 -2)

 Constants.h |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.137 llvm/include/llvm/Constants.h:1.138
--- llvm/include/llvm/Constants.h:1.137	Thu Mar  1 17:20:52 2007
+++ llvm/include/llvm/Constants.h	Thu Mar  1 18:27:06 2007
@@ -127,10 +127,18 @@
     return Val == 0; 
   }
 
+  /// This is just a convenience method to make client code smaller for a
+  /// common code. It also correctly performs the comparison without the
+  /// potential for an assertion from getZExtValue().
+  bool isZero() const {
+    return Val == 0;
+  }
+
   /// This is just a convenience method to make client code smaller for a 
-  /// common case.
+  /// common case. It also correctly performs the comparison without the
+  /// potential for an assertion from getZExtValue().
   /// @brief Determine if the value is one.
-  bool isUnitValue() const {
+  bool isOne() const {
     return Val == 1;
   }
 






More information about the llvm-commits mailing list