[llvm-commits] [llvm] r84175 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Nick Lewycky nicholas at mxc.ca
Sat Oct 17 17:44:15 PDT 2009


Chris Lattner wrote:
> 
> On Oct 15, 2009, at 12:11 AM, Nick Lewycky wrote:
> 
>> Author: nicholas
>> Date: Thu Oct 15 02:11:24 2009
>> New Revision: 84175
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=84175&view=rev
>> Log:
>> Teach basicaa about memcpy/memmove/memset. The length argument can be 
>> used to
>> improve alias results if constant, and the source pointer can't be 
>> modified.
> 
> Hi Nick,
> 
> Please write some testcases that fail without this and pass with it.

Added in r84385.

   I'm pretty sure that this is already
> handled by logic in AliasAnalysis that knows that memset only looks at 
> its arguments:

No, that isn't enough. memmove/memcpy have an argument that they never 
write to. The existing logic returns ModRef against that pointer, while 
we know we can return Ref.

Similarly, when alias() isn't given the size, it has to assume that the 
possible writer will write over the whole thing, and any two pointers 
which are computed as offset from the same base are potentially 
aliasing. By pulling the size out of memmove/memcpy/memset, we can 
return NoModRef in cases where the fallback code could not.

Nick



More information about the llvm-commits mailing list