diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-05-11 07:10:43 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-05-11 07:10:43 +0000 |
commit | c59ced36aa96c64dcb481421c113f6f9a11b4cbc (patch) | |
tree | a7b3845bda8470fb6f1c966679ecf606637022df /llvm/lib/Support/APInt.cpp | |
parent | f3fde7e851bb059a73c433c72051234030a0ead5 (diff) | |
download | bcm5719-llvm-c59ced36aa96c64dcb481421c113f6f9a11b4cbc.tar.gz bcm5719-llvm-c59ced36aa96c64dcb481421c113f6f9a11b4cbc.zip |
[APInt] Remove an unneeded extra temporary APInt from toString.
Turns out udivrem can write its output to the same location as one of its inputs so the extra temporary isn't needed.
llvm-svn: 302772
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index d000ae82e07..6b01c9bb277 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1953,15 +1953,11 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, } else { APInt divisor(Tmp.getBitWidth(), Radix); APInt APdigit; - APInt tmp2(Tmp.getBitWidth(), 0); while (Tmp.getBoolValue()) { - udivrem(Tmp, divisor, tmp2, APdigit); + udivrem(Tmp, divisor, Tmp, APdigit); unsigned Digit = (unsigned)APdigit.getZExtValue(); assert(Digit < Radix && "divide failed"); Str.push_back(Digits[Digit]); - // Move the quotient into Tmp and move the old allocation of Tmp into - // tmp2 to be used on the next loop iteration. - std::swap(Tmp, tmp2); } } |