[DebugInfo] ValueMapper impl for DIArgList respects IgnoreMissingLocals
authorStephen Tozer <stephen.tozer@sony.com>
Mon, 17 Jan 2022 11:42:35 +0000 (11:42 +0000)
committerStephen Tozer <stephen.tozer@sony.com>
Mon, 17 Jan 2022 17:17:32 +0000 (17:17 +0000)
commit32417b32033925b26b3695b753b38fbc6fdcd93d
treefeb345b12367e007acd6bd7d6a1cdff5d4bc1cf3
parente6698f09929a134bf0f46d9347142b86d8f636a2
[DebugInfo] ValueMapper impl for DIArgList respects IgnoreMissingLocals

This patch fixes an issue in which SSA value reference within a
DIArgList would be unnecessarily dropped by llvm-link, even when
invoking on a single file (which should be a no-op). The reason for the
difference is that the ValueMapper does not refer to the
RF_IgnoreMissingLocals flag for LocalAsMetadata contained within a
DIArgList; this flag is used for direct LocalAsMetadata uses to preserve
SSA references even when the ValueMapper does not have an explicit
mapping for the referenced SSA value, which appears to always be the
case when using llvm-link in this manner.

Differential Revision: https://reviews.llvm.org/D114355
llvm/lib/Transforms/Utils/ValueMapper.cpp
llvm/test/Linker/debug-info-use-before-def.ll [new file with mode: 0644]
llvm/unittests/Transforms/Utils/ValueMapperTest.cpp