jdoerfert added a comment.

I added the warning and typo recognition as discussed in IRC. We list known 
assumption strings in the documentation and SemaDeclAttr. As we add new ones we 
should include a short description or link to their meaning. The ones I added 
so far are OpenMP specific (dubbed `omp_XXX`) and the OpenMP standard is given 
as reference.

In D91979#2440554 <https://reviews.llvm.org/D91979#2440554>, @aaron.ballman 
wrote:

> Thank you for your patience with the delays getting to your review! Along 
> with the documentation question, one line of thinking I'm also not clear on 
> is whether this should be a type-based attribute rather than a 
> declaration-based attribute. For instance, if you want to write an assumption 
> about the parameters to a function, those are not in scope for a declaration 
> attribute but are for a type attribute.

I would like to see that, in our last proposal of something similar we 
suggested to add something like `__attribute__((arg_attr(3, "nofree")))` which 
would translate to the `nofree` IR attribute for argument 3. I can also 
envision a type based assumption attribute but I feel a declaration one will be 
needed nevertheless. We'll also add expression assumptions as they are required 
by OpenMP and generally useful. The "payload" of the assume attribute will then 
be a union, similar to the `AlignedAttribute`.

> But also, it seems like this assumption information is something that would 
> be useful to carry around as part of the function's identity. For instance, 
> would users want to be able to make a call through a function pointer and 
> have the same set of assumptions conveyed to the backend?

Like other IR attributes, if you can go from the function pointer to a (set of) 
declaration(s) you can use the attributes from that declaration. I don't think 
this is any different than other function attributes, e.g., `readnone` in this 
aspect.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91979

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to