[MemorySSA] Use provided memory location even if instruction is call
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 3 Oct 2020 15:28:12 +0000 (17:28 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 4 Nov 2020 19:30:22 +0000 (20:30 +0100)
commit52b86d35a401eaaeaffbd5ed99b0cd3f4250254d
tree212c74079f8c0f310a075057cea37eb754fb33db
parent09f2c92e5b340d18cd2b505de7bd23ca31d61840
[MemorySSA] Use provided memory location even if instruction is call

If getClobberingMemoryAccess() is called with an explicit
MemoryLocation, but the starting access happens to be a call, the
provided location is currently ignored, and alias analysis queries
will be performed against the call instruction instead. Something
similar happens if the starting access is a load with a MemoryDef.

Change the implementation to not set Q.Inst in the first place if
we want to perform a MemoryLocation-based query, to make sure it
can't be turned into an Instruction-based query along the way...

Additionally, remove the special handling that lifetime.start
intrinsics currently get. They simply report NoAlias for clobbers
between lifetime.start and other calls, but that's obviously not
right if the other call is something like a memset or memcpy. The
default behavior we get from getModRefInfo() will already do the
right thing here.

Differential Revision: https://reviews.llvm.org/D88782
llvm/lib/Analysis/MemorySSA.cpp
llvm/unittests/Analysis/MemorySSATest.cpp