[llvm] [ThinLTO] Don't convert functions to declarations if `force-import-all` is enabled (PR #134541)
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 9 09:29:12 PDT 2025
================
@@ -1701,13 +1701,16 @@ void llvm::thinLTOFinalizeInModule(Module &TheModule,
if (NewLinkage == GV.getLinkage())
return;
+ bool ForceImportFunction = isa<Function>(GV) && ForceImportAll;
+
// Check for a non-prevailing def that has interposable linkage
// (e.g. non-odr weak or linkonce). In that case we can't simply
// convert to available_externally, since it would lose the
// interposable property and possibly get inlined. Simply drop
// the definition in that case.
if (GlobalValue::isAvailableExternallyLinkage(NewLinkage) &&
- GlobalValue::isInterposableLinkage(GV.getLinkage())) {
+ GlobalValue::isInterposableLinkage(GV.getLinkage()) &&
+ !ForceImportFunction) {
----------------
cachemeifyoucan wrote:
My suggestion is to prevent `weak_common` turning into available_externally in the first place (I think it happens in `thinLTOResolvePrevailingGUID`).
https://github.com/llvm/llvm-project/pull/134541
More information about the llvm-commits
mailing list