[PATCH] D134308: AtomicExpand: Use llvm.ptrmask instead of ptrtoint

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 15:26:18 PDT 2022


jyknight added a comment.

Can you explain what effect you expect this to have? It removes all the inttoptr -- maybe that's useful in itself?

Is the remaining `inttoptr` to get the low bits harmful? Being able to omit the ptrtoint when the value is sufficiently aligned seems likely to be nearly useless -- this code is only used when the width of the atomic operation requested is smaller than the smallest size of atomic supported by the hardware. And sure, the smaller value could be overaligned in some cases, but...



================
Comment at: llvm/lib/CodeGen/AtomicExpandPass.cpp:707
+  Type *WordPtrType = PMV.WordType->getPointerTo(PtrTy->getAddressSpace());
+  if (!PtrTy->isOpaquePointerTy())
+    PMV.AlignedAddr =
----------------
This "if" seems extraneous -- Builder.CreateBitCast is already a no-op internally if it's asked to cast between opaque pointers, right?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134308/new/

https://reviews.llvm.org/D134308



More information about the llvm-commits mailing list