[llvm] [MergeFunctions] Preserve import GUIDs when folding functions (PR #207003)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 8 14:46:30 PDT 2026
================
@@ -880,19 +881,35 @@ static bool isODR(const Function *F) {
return F->hasWeakODRLinkage() || F->hasLinkOnceODRLinkage();
}
-static void mergeEntryCountsInto(Function *F, std::optional<uint64_t> FC,
- std::optional<uint64_t> GC) {
- if (!FC && !GC)
+static DenseSet<GlobalValue::GUID> unionImportGUIDs(const Function *F,
+ const Function *G) {
+ DenseSet<GlobalValue::GUID> AllImports = F->getImportGUIDs();
+ DenseSet<GlobalValue::GUID> GImports = G->getImportGUIDs();
+ AllImports.insert(GImports.begin(), GImports.end());
+ return AllImports;
+}
+
+static void
+mergeEntryCountsAndImportsInto(Function *F, std::optional<uint64_t> FC,
----------------
mtrofin wrote:
nit: `F` could be passed by ref, because there's no point in passing a nullptr here (same point as above - hints the contract for the caller).
https://github.com/llvm/llvm-project/pull/207003
More information about the llvm-commits
mailing list