[PATCH] D63067: [Attributor] NoAlias on return values.
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 07:39:25 PDT 2019
jdoerfert added a comment.
In D63067#1538120 <https://reviews.llvm.org/D63067#1538120>, @lebedev.ri wrote:
> In D63067#1538100 <https://reviews.llvm.org/D63067#1538100>, @sstefan1 wrote:
>
> > > Why should the return values in nonnull.ll be noalias?
> >
> > All functions returning pointer never actually capture it, or they return null. Isn't that enough?
>
>
> This doesn't seem sufficient to me.
> Consider:
>
> file1.c
> int* getter();
> int* callee0() { // will get marked as noalias
> return getter();
> }
> int* callee1() { // will get marked as noalias
> return getter();
> }
> int entry() {
> int* p0 = callee0();
> int* p1 = callee1();
> // do p0 and p1 alias?
> }
>
> file2.c
> int* global;
> int* getter() { return global; } // oops
>
>
The problem is the pointers returned need to be `noalias` return pointers as well (that is the missing sufficient condition).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63067/new/
https://reviews.llvm.org/D63067
More information about the llvm-commits
mailing list