================

----------------
mmjjpp wrote:

I reconsidering the !F.isDefinitionExact() part of this condition. My original 
intent was to be conservative: these functions (weak/linkonce/etc.) have 
definitions that may be replaced at link time, so I wanted to ensure only one 
partition keeps the real definition and others get available_externally.

However, I'm now leaning towards removing it. Functions with non-exact 
definitions (weak, linkonce, etc.) are inherently designed to support multiple 
definitions — the linker deduplicates them at link time, so there is no 
duplicate symbol risk. If such a function is defined in multiple partitions, 
the linker will select one definition regardless, so forcing 
available_externally on the duplicates is unnecessary.

After the change, the condition would simplify to:
if (!F.isDeclaration() && F.hasExternalLinkage())
  externalFunction[&F] = true;
This still covers all functions that would actually cause duplicate symbol 
issues (both originally-external functions and locals promoted to external by 
externalize()).

What do you think? Is there a case I'm missing where keeping the 
!isDefinitionExact() check would be important?

https://github.com/llvm/llvm-project/pull/198702
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to