HomePhabricator

[MemCpyOpt] Handle read from lifetime.start with offset

Authored by nikic on Mar 13 2021, 11:28 AM.

Description

[MemCpyOpt] Handle read from lifetime.start with offset

This fixes a regression from the MemDep-based implementation:
MemDep completely ignores lifetime.start intrinsics that aren't
MustAlias -- this is probably unsound, but it does mean that the
MemDep based implementation successfully eliminated memcpy's from
lifetime.start if the memcpy happens at an offset, rather than
the base address of the alloca.

Add a special case for the case where the lifetime.start spans the
whole alloca (which is pretty much the only kind of lifetime.start
that frontends ever emit), as we don't need to figure out our exact
aliasing relationship in that case, the whole alloca is dead prior
to the call.

If this doesn't cover all practically relevant cases, then it
would be possible to make use of the recently added PartialAlias
clobber offsets to make this more precise.

Details

Committed
nikicMar 13 2021, 11:38 AM
Parents
rGa10bf5572d2a: [MemCpyOpt] Add additional tests for memcpy of undef (NFC)
Branches
Unknown
Tags
Unknown