diff options
author | Hans Wennborg <hans@chromium.org> | 2022-01-18 17:30:27 +0100 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2022-01-18 17:41:49 +0100 |
commit | 53a51acc361a6b20b23b032226b0a7b124465cf7 (patch) | |
tree | 41547c5a88eb973212d75c7cd5387625451b34f8 /llvm/lib/Object/ArchiveWriter.cpp | |
parent | e598913a4734ce682732703bb362dc3c5c0079c0 (diff) | |
download | llvm-53a51acc361a6b20b23b032226b0a7b124465cf7.zip llvm-53a51acc361a6b20b23b032226b0a7b124465cf7.tar.gz llvm-53a51acc361a6b20b23b032226b0a7b124465cf7.tar.bz2 |
Revert "[MemCpyOpt] Make capture check during call slot optimization more precise"
This casued a miscompile due to call slot optimization replacing a call
argument without considering the call's !noalias metadata, see discussion on
the code review.
> Call slot optimization is currently supposed to be prevented if
> the call can capture the source pointer. Due to an implementation
> bug, this check currently doesn't trigger if a bitcast of the source
> pointer is passed instead. I'm somewhat afraid of the fallout of
> fixing this bug (due to heavy reliance on call slot optimization
> in rust), so I'd like to strengthen the capture reasoning a bit first.
>
> In particular, I believe that the capture is fine as long as a)
> the call itself cannot depend on the pointer identity, because
> neither dest has been captured before/at nor src before the
> call and b) there is no potential use of the captured pointer
> before the lifetime of the source alloca ends, either due to
> lifetime.end or a return from a function. At that point the
> potentially captured pointer becomes dangling.
>
> Differential Revision: https://reviews.llvm.org/D115615
Also reverting the dependent commit:
> [MemCpyOpt] Look through pointer casts when checking capture
>
> The user scanning loop above looks through pointer casts, so we
> also need to strip pointer casts in the capture check. Previously
> the source was incorrectly considered not captured if a bitcast
> was passed to the call.
This reverts commit 487a34ed9d7d24a7b1fb388c8856c784a459b22b
and 00e6869463ae6023d0d48f30de8511d6d748b14f.
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
0 files changed, 0 insertions, 0 deletions