[PATCH] D99135: [deref] Implement initial set of inference rules for deref-at-point
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 23 11:26:12 PDT 2021
nlopes added inline comments.
================
Comment at: llvm/lib/IR/Value.cpp:756
+ // on F's behalf either.
+ if (A->hasNoFreeAttr() && A->hasNoAliasAttr())
+ return false;
----------------
reames wrote:
> nlopes wrote:
> > I don't understand this argument of why hasNoSync isn't needed.
> > All argument attributes are with respect to what the function does, not the environment. It would be impossible to infer attributes if the environment was considered.
> >
> > My understanding is that readonly implies nofree. Can't see why nofree would have those special semantics
> The focus here isn't on nofree implying nosync. It's noalias which implies nosync. In order to for there to be a written (freed) copy of the pointer accessible in the other thread, the noalias fact must be false. If so, that's already UB.
Ok, I confess I'm less familiar with the noalias attribute. Though memcpy's signature is something like:
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1
The caller of memcpy may have had the src/dst pointers escaped to other threads. Even then, both arguments are marked as noalias because the C spec says the arguments cannot overlap.
This contradicts the global definition of noalias you are suggesting.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99135/new/
https://reviews.llvm.org/D99135
More information about the llvm-commits
mailing list