[PATCH] D50679: [BasicAA] Don't assume tail calls with byval don't alias allocas

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 17:39:57 PDT 2018


rnk added a comment.

In https://reviews.llvm.org/D50679#1198237, @hfinkel wrote:

> The DSE test is fine, and I think that you should keep it, but can you please add a direct AA test (like, e.g., test/Analysis/BasicAA/cs-cs.ll)?
>
> Should we just always return ModRefInfo::Ref in this case? It can read the data (to copy it), but can't write, correct?


I thought about that, but I think the code below this check is usually more precise in these cases. It tests if the alloca isNonEscapingLocalObject and then looks at each argument to see if it is actually used by the call. For local objects that *are* escaping, we could return ModRefInfo::Ref. Basically, we already get this test case:

  define void @dead(i32* byval %x) {
  entry:
    %p = alloca i32
    %q = alloca i32
    %v = load i32, i32* %x
    store i32 %v, i32* %p
    store i32 1, i32* %q  ; DEAD
    tail call void @g(i32* byval %p)
    store i32 2, i32* %q
    call void @escape(i32* %q)
    ret void
  }


https://reviews.llvm.org/D50679





More information about the llvm-commits mailing list