OSDN Git Service

[MemorySSA] Don't treat lifetime.end as NoAlias
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 31 Jan 2021 16:55:24 +0000 (17:55 +0100)
committerTom Stellard <tstellar@redhat.com>
Sat, 6 Feb 2021 04:40:28 +0000 (20:40 -0800)
commit12a772b1a09a1b5c3f43d08c2804973506b8a859
tree6a5d7674d1544d33f4717617712a8b21f4d2745d
parent81febec8a327ecbe83575ac280c2931718ab5e33
[MemorySSA] Don't treat lifetime.end as NoAlias

MemorySSA currently treats lifetime.end intrinsics as not aliasing
anything. This breaks MemorySSA-based MemCpyOpt, because we'll happily
move a read of a pointer below a lifetime.end intrinsic, as no clobber
is reported.

I think the MemorySSA modelling here isn't correct: lifetime.end(p)
has approximately the same effect as doing a memcpy(p, undef), and
should be treated as a clobber.

This patch removes the special handling of lifetime.end, leaving
alias analysis to handle it appropriately.

Differential Revision: https://reviews.llvm.org/D95763
llvm/lib/Analysis/MemorySSA.cpp
llvm/test/Analysis/MemorySSA/lifetime-simple.ll
llvm/test/Transforms/MemCpyOpt/lifetime.ll