[llvm-commits] [llvm] r152688 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp

Benjamin Kramer benny.kra at googlemail.com
Tue Mar 13 17:01:35 PDT 2012


Author: d0k
Date: Tue Mar 13 19:01:35 2012
New Revision: 152688

URL: http://llvm.org/viewvc/llvm-project?rev=152688&view=rev
Log:
Move APInt::operator! inline, it's small and fuses well with surrounding code when inlined.

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=152688&r1=152687&r2=152688&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Tue Mar 13 19:01:35 2012
@@ -561,7 +561,15 @@
   /// Performs logical negation operation on this APInt.
   /// @returns true if *this is zero, false otherwise.
   /// @brief Logical negation operator.
-  bool operator!() const;
+  bool operator!() const {
+    if (isSingleWord())
+      return !VAL;
+
+    for (unsigned i = 0; i != getNumWords(); ++i)
+      if (pVal[i])
+        return false;
+    return true;
+  }
 
   /// @}
   /// @name Assignment Operators

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=152688&r1=152687&r2=152688&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Tue Mar 13 19:01:35 2012
@@ -457,16 +457,6 @@
   return APInt(val, getBitWidth()).clearUnusedBits();
 }
 
-bool APInt::operator !() const {
-  if (isSingleWord())
-    return !VAL;
-
-  for (unsigned i = 0; i < getNumWords(); ++i)
-    if (pVal[i])
-      return false;
-  return true;
-}
-
 APInt APInt::operator*(const APInt& RHS) const {
   assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
   if (isSingleWord())





More information about the llvm-commits mailing list