llvm.org GIT mirror llvm / 5c7bb0a
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302772 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 3 years ago
1 changed file(s) with 1 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
19521952 } else {
19531953 APInt divisor(Tmp.getBitWidth(), Radix);
19541954 APInt APdigit;
1955 APInt tmp2(Tmp.getBitWidth(), 0);
19561955 while (Tmp.getBoolValue()) {
1957 udivrem(Tmp, divisor, tmp2, APdigit);
1956 udivrem(Tmp, divisor, Tmp, APdigit);
19581957 unsigned Digit = (unsigned)APdigit.getZExtValue();
19591958 assert(Digit < Radix && "divide failed");
19601959 Str.push_back(Digits[Digit]);
1961 // Move the quotient into Tmp and move the old allocation of Tmp into
1962 // tmp2 to be used on the next loop iteration.
1963 std::swap(Tmp, tmp2);
19641960 }
19651961 }
19661962