[PATCH] D89321: [MemLoc] Support memchr/memccpy in MemoryLocation::getForArgument

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 02:52:17 PDT 2020


xbolva00 added inline comments.


================
Comment at: llvm/lib/Analysis/MemoryLocation.cpp:262
+              dyn_cast<ConstantInt>(Call->getArgOperand(3)))
+        return MemoryLocation(Arg, LocationSize::precise(LenCI->getZExtValue()),
+                              AATags);
----------------
fhahn wrote:
> Thinking about this again, I am not sure if this is a good idea to do for the destination argument, because it gives the impression that exactly `LenCI` bytes are written, when this is not the case.
> 
> I think for reads the larger size is the conservative option  and fine, but for writing it could mis-lead clients into thinking the call writes more bytes than it actually does, leading to potentially invalid optimizations. 
Makes sense, I will prepare fix to skip doing this for dst.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89321



More information about the llvm-commits mailing list