[PATCH] D63067: [Attributor] NoAlias on return values.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 07:29:37 PDT 2019


lebedev.ri added a comment.

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


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