[PATCH] D84860: [LangRef] Add uniqueptr attribute.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 10:28:48 PDT 2020


fhahn added a comment.

In D84860#2182575 <https://reviews.llvm.org/D84860#2182575>, @hfinkel wrote:

> 



>>> No, that's okay. The "based on" relationship flows through memory as well. The C spec for restrict does a better job than the LangRef does in this respect in formalizing that, but our semantics need to allow this too (otherwise our SSA conversation in SROA/mem2reg would not be sound for noalias pointers).
>>
>> Agreed, thanks for confirming.
>>
>>> In this case, PTR is based on &x, and accesses through it in `sideeffect` are allowed even if x is noalias. One of the things that makes handling noalais pointers more-difficult than one might expect is, specifically, that we do need to check for cases where the restrict pointer itself escapes because then any other pointer of unknown provenance might be based on it.
>>
>> I guess I am curious how the restrict pointer itself can escape in such a way?
>
> What do you mean? Just like in your example, it can be assigned to a global variable (or, it can be assigned to *p, where p is an argument).

Oh right, I thought you meant there are cases where escaping is not allowed on the C level, but you meant we need to be careful during alias analysis?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84860



More information about the llvm-commits mailing list