[MemorySSA] Don't bail on phi starting access
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 12 Mar 2021 22:03:36 +0000 (23:03 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 13 Mar 2021 09:53:13 +0000 (10:53 +0100)
commitb2f933a6ce838a24f5e9728126c71d3ba44a99be
treeb2a3c6229c9e40074269d4714d7547225faa2e7a
parenta9b9c64fd4c8d456f11dcbd409cdd62116eb021f
[MemorySSA] Don't bail on phi starting access

When calling getClobberingMemoryAccess() with MemoryLocation on a
MemoryPHI starting access, the walker currently immediately bails
and returns the starting access. This makes sense for the API that
does not accept a location (as we wouldn't know what clobber we
should be checking for), but doesn't make sense for the
MemoryLocation-based API. This means that it can't look through
a MemoryPHI if it's the starting access, but can if there is one
more non-clobbering def in between. This patch removes the limitation.

Differential Revision: https://reviews.llvm.org/D98557
llvm/lib/Analysis/MemorySSA.cpp
llvm/test/Transforms/MemCpyOpt/memcpy-in-loop.ll