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

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 13 17:42:33 PDT 2018


hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D50679#1198248, @rnk wrote:

> 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
>   }
>


Ah. Good point.

Please add a direct AA test case. Otherwise, LGTM.


https://reviews.llvm.org/D50679





More information about the llvm-commits mailing list