[PATCH] D31968: Remove all allocation and divisions from GreatestCommonDivisor

Richard Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 14:40:44 PDT 2017


rsmith marked 5 inline comments as done.
rsmith added a comment.

In https://reviews.llvm.org/D31968#724522, @craig.topper wrote:

> Can we just merge lshrNear fully into lshrInPlace and just use lshrInPlace in the other place that uses lshrNear?


Merging `lshrNear` into `lshrInPlace` makes the code significantly less clear (relabeling the variables in the call helps a lot).

I switched the other caller (`APInt::byteSwap`) to use `lshrInPlace`. We can actually just remove that function if you prefer, since it is unused.



================
Comment at: lib/Support/APInt.cpp:783
+  if (Shift == 0) {
+    std::memmove(Dst, Src, Words * 8);
+    return;
----------------
craig.topper wrote:
> Use APINT_WORD_SIZE instead of 8.
Done, I also changed the parameter type from `uint64_t` to `APInt::WordType` to avoid specifying "64" there but not here.


Repository:
  rL LLVM

https://reviews.llvm.org/D31968





More information about the llvm-commits mailing list