Add switch to use "source_filename" instead of a hash ID for globally promoted local
authorBill Wendling <morbo@google.com>
Mon, 18 Jul 2022 19:05:53 +0000 (12:05 -0700)
committerBill Wendling <morbo@google.com>
Wed, 3 Aug 2022 23:41:56 +0000 (16:41 -0700)
commit239c831de4d09530ebd4e254f9248764792afa5e
tree65dc1d20d57d21190960e0f9d370a035c714f046
parentca8de2d242c4fa5c4fa83e77d014da3067d0a3b0
Add switch to use "source_filename" instead of a hash ID for globally promoted local

During LTO a local promoted to a global gets a unique suffix based on
a hash of the module IR. This means that changes in the local's module
can affect the contents in another module that imported it (because the name
of the imported promoted local is changed, but that doesn't reflect a
real change in the importing module). So any tool that's
validating changes to the importing module will see a superficial change.

Instead of using the module hash, we can use the "source_filename" if it
exists to generate a unique identifier that doesn't change due to LTO
shenanigans.

Differential Revision: https://reviews.llvm.org/D128863
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/lib/Transforms/Utils/FunctionImportUtils.cpp
llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll [new file with mode: 0644]
llvm/test/ThinLTO/X86/promote-local-name.ll [new file with mode: 0644]