[PATCH] D27034: [AliasAnalysis] Teach BasicAA about memcpy.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 08:11:53 PST 2016


hfinkel added inline comments.


================
Comment at: lib/Analysis/BasicAliasAnalysis.cpp:777
+
+    if ((SrcAA = getBestAAResults().alias(MemoryLocation::getForSource(Inst),
+                                          Loc)) == MustAlias)
----------------
bryant wrote:
> hfinkel wrote:
> > Please add a comment here explaining why you can return MRI_Ref without even checking the destination (i.e. that you're relying on the memcpy semantics which forbid overlapping memory). With that, this LGTM.
> > 
> > We really should also add similar logic here for memmove and memset. Would you do this as follow-up?
> > 
> > We really should also add similar logic here for memmove and memset. Would you do this as follow-up?
> 
> Sure, but memmove permits source and destination to overlap, and memset splats a constant onto a destination. What sort of similar logic did you have in mind?
Never mind. MemoryLocation::getForArgument already has special handling for memmove, etc. You're right, memcpy is the one that benefits from special handling.


Repository:
  rL LLVM

https://reviews.llvm.org/D27034





More information about the llvm-commits mailing list