[MemCpyOpt] Fix metadata merging during call slot optimization
authorNikita Popov <npopov@redhat.com>
Wed, 19 Jan 2022 14:47:13 +0000 (15:47 +0100)
committerNikita Popov <npopov@redhat.com>
Thu, 20 Jan 2022 08:25:13 +0000 (09:25 +0100)
commitd7bff2e9d2e4639ab7f3b5df49c235b9eeebdb51
tree40d636b19cf9621dff5fa660bd520113135a7304
parent22ee510dac9440a74b2e5b3fe3ff13ccdbf55af3
[MemCpyOpt] Fix metadata merging during call slot optimization

Call slot optimization currently merges the metadata between the
call and the load. However, we also need to merge in the metadata
of the store.

Part of the reason why we might have gotten away with this
previously is that usually the load and the store are the same
instruction (a memcpy), this can only happen if call slot
optimization occurs on an actual load/store pair.

This addresses the issue reported in
https://reviews.llvm.org/D115615#3251386.

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