[Linker] Replace comdat based bool LinkFromSrc with enum class LinkFrom and improve...
authorFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 20:56:31 +0000 (13:56 -0700)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 20:56:32 +0000 (13:56 -0700)
commit510e106fa8635e7f9c51c896180b971de6309b2f
tree92d6dc00c38023ae669f83a7d5369558ed2290a1
parentae5e5f2011d583b9462a5747e22a0727a1b9b3bf
[Linker] Replace comdat based bool LinkFromSrc with enum class LinkFrom and improve nodeduplicate tests. NFC

This is different from symbol resolution based LinkFromSrc.  Rename to be
clearer.

In the future we may support a new enum member 'Both' for nodeduplicate. This is
feasible (by renaming to a private linkage GlobalValue), but we need to be
careful not to break InstrProfiling.cpp's expectation of parallel profd/profc.

The challenge is that current LTO symbol resolution only allows to mark one
profc as prevailing: the other profc in another comdat nodeduplicate may be
discarded while its associated profd isn't.
llvm/lib/Linker/LinkModules.cpp
llvm/test/Linker/comdat-nodeduplicate.ll