[PATCH] D139295: [Coroutines] Don't mark the parameter attribute of resume function as noalias

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 5 18:05:52 PST 2022


ChuanqiXu added a comment.

In D139295#3971557 <https://reviews.llvm.org/D139295#3971557>, @rjmccall wrote:

> I don't know what you mean about GEPs violating `noalias`.  As I understand it, `noalias` is like `restrict`; it says that it can be assumed that nothing aliases the parameter except pointers derived from it.  GEPs derive pointers in a way that is explicitly permitted under that.

Here are my understanding: in the LLVM IR language manual (https://llvm.org/docs/LangRef.html#parameter-attributes), it says:

> noalias
>
>   This indicates that memory locations accessed via pointer values based on the argument or return value are not also accessed, during the execution of the function, via pointer values not based on the argument or return value.

And in the pointer aliasing rules section (https://llvm.org/docs/LangRef.html#pointer-aliasing-rules), it says:

> A pointer value is based on another pointer value according to the following rules:
>
> - A pointer value formed from a scalar getelementptr operation is based on the pointer-typed operand of the getelementptr.

So a `gep` result is a pointer value based on the argument. And since the parameter is marked as `noalias`, we shouldn't access the pointer during the execution of the function. Here is my reading. I am not 100% sure I got things right. @nikic could you take a look?


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

https://reviews.llvm.org/D139295



More information about the llvm-commits mailing list