[GVN] Fix metadata combining for non-local loads
authorNikita Popov <npopov@redhat.com>
Thu, 20 Apr 2023 10:23:36 +0000 (12:23 +0200)
committerNikita Popov <npopov@redhat.com>
Thu, 20 Apr 2023 10:32:10 +0000 (12:32 +0200)
commit20e9b31f88149a1d5ef78c0be50051e345098e41
tree4cfc2cda66878eb39944749e2f6e9e85cb12bf53
parent80fda7a346630e490e8bc3a9cc0d5e0d35526ecb
[GVN] Fix metadata combining for non-local loads

Make MaterializeAdjustedValue() responsible for adjusting load
metadata in all cases, so it also covers the non-local case.

In conjunction with that, we no longer need to call
patchReplacementInstruction() for the local case, which would
unnecessarily drop metadata if the replacement value just happened
to be a load (without actual load CSE).
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/metadata.ll