Skip to content

Commit 51a3bc1

Browse files
[ThinLTO]Clean up 'import-assume-unique-local' flag. (#102424)
While manual compiles can specify full file paths and build automation tools use full, unique paths in practice, it's not clear whether it's a general good practice to enforce full paths (fail a build if relative paths are used). `NumDefs == 1` condition [1] should hold true for many internal-linkage vtables as long as full paths are indeed used to salvage the marginal performance when local-linkage vtables are imported due to indirect reference. #100448 (comment) has more details. [1] https://github.com/llvm/llvm-project/pull/100448/files#diff-e7cb370fee46f0f773f2b5429dfab36b75126d3909ae98ee87ff3d0e3f75c6e9R215
1 parent 93a31cd commit 51a3bc1

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

compiler-rt/test/profile/Linux/instrprof-vtable-value-prof.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@
141141
// RUN: -g -flto=thin -fwhole-program-vtables -fno-split-lto-unit -O2 \
142142
// RUN: -mllvm -enable-vtable-value-profiling -Wl,-mllvm,-enable-vtable-value-profiling \
143143
// RUN: -mllvm -enable-vtable-profile-use \
144-
// RUN: -Wl,-plugin-opt,-import-assume-unique-local \
145144
// RUN: -Wl,-mllvm,-enable-vtable-profile-use -Rpass=pgo-icall-prom \
146145
// RUN: -Wl,-mllvm,-print-after=pgo-icall-prom \
147146
// RUN: -Wl,-mllvm,-filter-print-funcs=main lib.cpp main.cpp 2>&1 \

llvm/lib/Transforms/IPO/FunctionImport.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,6 @@ static cl::opt<std::string> WorkloadDefinitions(
174174
"}"),
175175
cl::Hidden);
176176

177-
static cl::opt<bool> ImportAssumeUniqueLocal(
178-
"import-assume-unique-local", cl::init(false),
179-
cl::desc(
180-
"By default, a local-linkage global variable won't be imported in the "
181-
"edge mod1:func -> mod2:local-var (from value profiles) since compiler "
182-
"cannot assume mod2 is compiled with full path which gives local-var a "
183-
"program-wide unique GUID. Set this option to true will help cross "
184-
"module import of such variables. This is only safe if the compiler "
185-
"user specify the full module path."),
186-
cl::Hidden);
187-
188177
static cl::opt<std::string>
189178
ContextualProfile("thinlto-pgo-ctx-prof",
190179
cl::desc("Path to a contextual profile."), cl::Hidden);
@@ -214,9 +203,8 @@ static std::unique_ptr<Module> loadFile(const std::string &FileName,
214203
static bool shouldSkipLocalInAnotherModule(const GlobalValueSummary *RefSummary,
215204
size_t NumDefs,
216205
StringRef ImporterModule) {
217-
// We can import a local from another module if all inputs are compiled
218-
// with full paths or when there is one definition.
219-
if (ImportAssumeUniqueLocal || NumDefs == 1)
206+
// We can import a local when there is one definition.
207+
if (NumDefs == 1)
220208
return false;
221209
// In other cases, make sure we import the copy in the caller's module if the
222210
// referenced value has local linkage. The only time a local variable can

0 commit comments

Comments
 (0)