From 1dacfa74c8054e9117db5e68289318dd32c177fd Mon Sep 17 00:00:00 2001 From: mingmingl Date: Wed, 7 Aug 2024 21:50:04 -0700 Subject: [PATCH 1/2] [ThinLTO]Clean up 'import-assume-unique-local' flag --- .../profile/Linux/instrprof-vtable-value-prof.cpp | 1 - llvm/lib/Transforms/IPO/FunctionImport.cpp | 13 +------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp b/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp index 214c1504db7f4..e6a4af7b631e9 100644 --- a/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp +++ b/compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp @@ -141,7 +141,6 @@ // RUN: -g -flto=thin -fwhole-program-vtables -fno-split-lto-unit -O2 \ // RUN: -mllvm -enable-vtable-value-profiling -Wl,-mllvm,-enable-vtable-value-profiling \ // RUN: -mllvm -enable-vtable-profile-use \ -// RUN: -Wl,-plugin-opt,-import-assume-unique-local \ // RUN: -Wl,-mllvm,-enable-vtable-profile-use -Rpass=pgo-icall-prom \ // RUN: -Wl,-mllvm,-print-after=pgo-icall-prom \ // RUN: -Wl,-mllvm,-filter-print-funcs=main lib.cpp main.cpp 2>&1 \ diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 210b79e3a0adc..268b408fc7286 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -174,17 +174,6 @@ static cl::opt WorkloadDefinitions( "}"), cl::Hidden); -static cl::opt ImportAssumeUniqueLocal( - "import-assume-unique-local", cl::init(false), - cl::desc( - "By default, a local-linkage global variable won't be imported in the " - "edge mod1:func -> mod2:local-var (from value profiles) since compiler " - "cannot assume mod2 is compiled with full path which gives local-var a " - "program-wide unique GUID. Set this option to true will help cross " - "module import of such variables. This is only safe if the compiler " - "user specify the full module path."), - cl::Hidden); - namespace llvm { extern cl::opt EnableMemProfContextDisambiguation; } @@ -212,7 +201,7 @@ static bool shouldSkipLocalInAnotherModule(const GlobalValueSummary *RefSummary, StringRef ImporterModule) { // We can import a local from another module if all inputs are compiled // with full paths or when there is one definition. - if (ImportAssumeUniqueLocal || NumDefs == 1) + if (NumDefs == 1) return false; // In other cases, make sure we import the copy in the caller's module if the // referenced value has local linkage. The only time a local variable can From bf9106273e3a8a632a61b61bde3519a33214d36b Mon Sep 17 00:00:00 2001 From: mingmingl Date: Fri, 9 Aug 2024 16:47:11 -0700 Subject: [PATCH 2/2] update comment --- llvm/lib/Transforms/IPO/FunctionImport.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 1260aaa6afbd7..3364628be841e 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -203,8 +203,7 @@ static std::unique_ptr loadFile(const std::string &FileName, static bool shouldSkipLocalInAnotherModule(const GlobalValueSummary *RefSummary, size_t NumDefs, StringRef ImporterModule) { - // We can import a local from another module if all inputs are compiled - // with full paths or when there is one definition. + // We can import a local when there is one definition. if (NumDefs == 1) return false; // In other cases, make sure we import the copy in the caller's module if the