diff options
author | Craig Topper <craig.topper@sifive.com> | 2024-04-08 20:38:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-08 20:38:29 -0700 |
commit | 04f33a3ac2e8ca96840606f812eaef974ff61c80 (patch) | |
tree | c5d97332b1635a656da4b97554e10310e81ae2f9 /llvm/lib/Support/APInt.cpp | |
parent | 74c085fcfc8fab7822127cb46ff82a6f0d3597f3 (diff) | |
download | llvm-04f33a3ac2e8ca96840606f812eaef974ff61c80.zip llvm-04f33a3ac2e8ca96840606f812eaef974ff61c80.tar.gz llvm-04f33a3ac2e8ca96840606f812eaef974ff61c80.tar.bz2 |
[APInt] Use a std::move() to avoid a copy in the loop in multiplicativeInverse. (#87655)
This allows the subtract to reuse the storage of T. T will be assigned
over by the condition on the next iteration. I think assigning over a
moved from value should be ok.
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 224ea09..8825025 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1249,7 +1249,7 @@ APInt APInt::multiplicativeInverse() const { APInt Factor = *this; APInt T; while (!(T = *this * Factor).isOne()) - Factor *= 2 - T; + Factor *= 2 - std::move(T); return Factor; } |