[PATCH] D68484: [PATCH 01/38] [noalias] LangRef: noalias intrinsics and noalias_sidechannel documentation.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 16:11:32 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/docs/LangRef.rst:16303
+- ``p.objId``: a number that can be used to differentiate different *object P*
+  when ``%p.addr`` is optimized away.
+- ``!p.scope``: metadata argument that refers to a list of alias.scope metadata
----------------
jeroen.dobbelaere wrote:
> jdoerfert wrote:
> > This seems odd, why introduce two things that do the same thing.
> The original idea was to treat '%p.addr' sometimes as a pointer to an object and sometimes as an offset. Later it needed to be separated: SROA first splits alloca's into multiple smaller alloca's. Each separate restrict pointer now points to its own alloca (%p.addr), and there is no place to put the offset. You can differentiate by splitting the p.scope, but that would imply duplicating scopes all over the place. The p.objId serves as a convenient and less costly solution to differentiate the pointers in this case.
So `objId` is an offset into `p.addr`? If so, let's document it that way.

How does this work if there are multiple restrict pointers in the object, e.g. `struct { restrict *a; restrict *b }`? Maybe it would help if you point me towards the place where I can see this intrinsic in action. At least then I might be able to provide better feedback on the wording.


================
Comment at: llvm/docs/LangRef.rst:16306
+  entries that contains exactly one element. It represents the variable
+  declaration that contains one or more restrict pointers.
+- ``%p.decl``: points to the ``@llvm.noalias.decl`` intrinsic associated with
----------------
jeroen.dobbelaere wrote:
> jdoerfert wrote:
> > "entries with a single element each."
> > > It represents the variable declaration that contains one or more restrict pointers.
> > I do not understand this sentence.
> hmm. Not sure how to explain it further. What I want to say is (shown with an example:)
>   int *restrict A;  // one !p.scope, one restrict pointer
>   int *restrict B[10]; // another (single) !p.scope, ten restrict pointers
>   struct FOO { int* restrict mA; int * mB; int* restrict mC; } C; // yet another !p.scope, 2 restrict pointers
> 
> 
> 
> 
In that example, how doe the `p.scopes` look like? Or, asked differently, is the `p.scope` a consequence of the declaration, hence does it uniquely identifies a declaration?


================
Comment at: llvm/docs/LangRef.rst:16496
+not really represent a value. It is merely used to track a dependency on the
+declaration.
+
----------------
jeroen.dobbelaere wrote:
> jdoerfert wrote:
> > The above reads funny, maybe:
> > "The returned value is a handle to track dependences on the declaration. There is no explicit relationship to the value of the arguments."
> > Also, why do we want an `i8*` then? We have `tokens` and we have `i32`, I'd prefer either over an `i8*` which is more confusing in this context full of `i8*` that are actually pointers (IMHO).
> I think a token has to many restrictions (no PHI, no select). i32 might do. I didn't think too much about it and just settled on i8*.
If the token is too restrictive I'd still prefer an i32 (or similar) to avoid confusion with all the i8 pointers that fly around. The wording will then make it clear that these are tokens.


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

https://reviews.llvm.org/D68484





More information about the llvm-commits mailing list