[llvm] r302403 - [APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun May 7 21:55:12 PDT 2017


Author: ctopper
Date: Sun May  7 23:55:12 2017
New Revision: 302403

URL: http://llvm.org/viewvc/llvm-project?rev=302403&view=rev
Log:
[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.

Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=302403&r1=302402&r2=302403&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Sun May  7 23:55:12 2017
@@ -1842,10 +1842,6 @@ void APInt::fromString(unsigned numbits,
   // Figure out if we can shift instead of multiply
   unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
 
-  // Set up an APInt for the radix multiplier outside the loop so we don't
-  // constantly construct/destruct it.
-  APInt apradix(getBitWidth(), radix);
-
   // Enter digit traversal loop
   for (StringRef::iterator e = str.end(); p != e; ++p) {
     unsigned digit = getDigit(*p, radix);
@@ -1856,7 +1852,7 @@ void APInt::fromString(unsigned numbits,
       if (shift)
         *this <<= shift;
       else
-        *this *= apradix;
+        *this *= radix;
     }
 
     // Add in the digit we just interpreted




More information about the llvm-commits mailing list