[PATCH] D45584: [DSE] Teach the pass about partial overwrite of atomic memory intrinsics

Daniel Neilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 3 11:58:01 PDT 2018


dneilson added inline comments.


================
Comment at: lib/Transforms/Scalar/DeadStoreElimination.cpp:917
+    const uint32_t ElementSize = AMI->getElementSizeInBytes();
+    // Note: ElementSize must be a power of 2
+    if (NewLength & (ElementSize - 1))
----------------
mkazantsev wrote:
> There are already existing functions for this, like `isPowerOf2_32`, can you please use one of them?
Perhaps a misleading comment. The line below this is checking whether NewLength is an integer multiple of ElementSize (i.e. whether NewLength % ElementSize == 0), but I did it via a bit operation because we know that ElementSize must be a power of 2 (via the spec for the atomic memory intrinsics).

I'll just use the modulo operator; less potential for confusion.


Repository:
  rL LLVM

https://reviews.llvm.org/D45584





More information about the llvm-commits mailing list