[MemCpyOpt] Move lifetime marker before call to enable call slot optimization
authorNikita Popov <npopov@redhat.com>
Thu, 13 Oct 2022 14:45:37 +0000 (16:45 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 7 Nov 2022 14:26:00 +0000 (15:26 +0100)
commit9a45e4beede24fdcd6b7d95416d0447ba154651c
tree68fb1cd9c18cce746fdd1991324703d2bc01f835
parentbada35390ad77ea023df7fa027d6de717b79bce2
[MemCpyOpt] Move lifetime marker before call to enable call slot optimization

Currently call slot optimization may be prevented because the
lifetime markers for the destination only start after the call.
In this case, rather than aborting the transform, we should move
the lifetime.start before the call to enable the transform.

Differential Revision: https://reviews.llvm.org/D135886
llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
llvm/test/Transforms/MemCpyOpt/lifetime.ll