Skip to content

Commit d39d1a2

Browse files
committed
Revert "[LLD][ThinLTO] Handle GUID collision in import global processing"
This reverts commit cc0b964. The commit is causing a failure in internal testing. Will recommit with a fix later.
1 parent add76dd commit d39d1a2

File tree

3 files changed

+5
-40
lines changed

3 files changed

+5
-40
lines changed

llvm/lib/Transforms/Utils/FunctionImportUtils.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,11 @@ void FunctionImportGlobalProcessing::processGlobalForThinLTO(GlobalValue &GV) {
239239
// propagateConstants hasn't been run. We can't internalize GV
240240
// in such case.
241241
if (!GV.isDeclaration() && VI && ImportIndex.withGlobalValueDeadStripping()) {
242-
if (GlobalVariable *V = dyn_cast<GlobalVariable>(&GV)) {
243-
// We can have more than one local with the same GUID, in the case of
244-
// same-named locals in different but same-named source files that were
245-
// compiled in their respective directories (so the source file name
246-
// and resulting GUID is the same). Find the one in this module.
247-
auto* GVS = dyn_cast<GlobalVarSummary>(
248-
ImportIndex.findSummaryInModule(VI, M.getModuleIdentifier()));
249-
// At this stage "maybe" is "definitely"
250-
if (GVS && (GVS->maybeReadOnly() || GVS->maybeWriteOnly()))
251-
V->addAttribute("thinlto-internalize");
252-
}
242+
const auto &SL = VI.getSummaryList();
243+
auto *GVS = SL.empty() ? nullptr : dyn_cast<GlobalVarSummary>(SL[0].get());
244+
// At this stage "maybe" is "definitely"
245+
if (GVS && (GVS->maybeReadOnly() || GVS->maybeWriteOnly()))
246+
cast<GlobalVariable>(&GV)->addAttribute("thinlto-internalize");
253247
}
254248

255249
bool DoPromote = false;

llvm/test/ThinLTO/X86/Inputs/guid_collision.ll

Lines changed: 0 additions & 12 deletions
This file was deleted.

llvm/test/ThinLTO/X86/guid_collision.ll

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)