[PATCH] D135597: [LangRef] Add memory attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 10:48:58 PDT 2022


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

I like the wording now, thanks for the changes. Others should approve as well though.

In D135597#3858610 <https://reviews.llvm.org/D135597#3858610>, @nikic wrote:

> In D135597#3858550 <https://reviews.llvm.org/D135597#3858550>, @xbolva00 wrote:
>
>> Just FYI,
>>
>> https://github.com/llvm/llvm-project/issues/54312 :
>>
>>> I would recommend not to add size to the existing ones but instead replace them as whole. That said, mapping all but the size argument to existing ones would be great and pretty straight forward (IMHO).
>>
>> What do you think, should 'memory' attribute take  arg-index and size-index into account to support use cases like access attribute in C?
>
> I don't think so. The memory attribute describes the memory effects of the whole call/function. We have separate attributes that apply to individual arguments.

I agree. Argument access information should be attached to the arguments. 
So `__attribute__ ((access (read_only, 2, 3))) void* memcpy (void*, const void*, size_t);` would become

  declare i8* memcpy(i8* access(write[0:arg(2)]) %dst, i8* access(read[0:arg(2)]) %src, i32 %size) memory(argmem: readwrite)

And we should do this after.


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

https://reviews.llvm.org/D135597



More information about the llvm-commits mailing list