Skip to content

Commit 1cf9bc2

Browse files
committed
Clean up external users of GlobalValue::getGUID(StringRef)
See https://discourse.llvm.org/t/rfc-keep-globalvalue-guids-stable/84801 for context. This is a non-functional change which just changes the interface of GlobalValue, in preparation for future functional changes. This part touches a fair few users, so is split out for ease of review. Future changes to the GlobalValue implementation can then be focused purely on that class. This does the following: * Make global identifier computation nominally private. There are a few users we can't remove yet, but we rename the method to make it clear that new users shouldn't be added. * Rename GlobalValue::getGUID(StringRef) to getGUIDAssumingExternalLinkage. This is simply making explicit at the callsite what is currently implicit. * Where possible, migrate users to directly calling getGUID on a GlobalValue instance. * Otherwise, where possible, have them call the newly renamed getGUIDAssumingExternalLinkage, to make the assumption explicit. * Where users don't actually need the gloalIdentifier and just need the name, call getName() instead. * There are a few cases where none of the above are possible, as the caller saves and reconstructs the necessary information to compute the GUID themselves. We want to migrate these callers eventually, but for this first step we leave them be and allow them to call our nominally private global identifier computation method.
1 parent 4fde8c3 commit 1cf9bc2

29 files changed

+122
-86
lines changed

llvm/include/llvm/IR/GlobalValue.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ class GlobalValue : public Constant {
570570
return Name;
571571
}
572572

573+
/// Declare a type to represent a global unique identifier for a global value.
574+
/// This is a 64 bits hash that is used by PGO and ThinLTO to have a compact
575+
/// unique way to identify a symbol.
576+
using GUID = uint64_t;
577+
573578
/// Return the modified name for a global value suitable to be
574579
/// used as the key for a global lookup (e.g. profile or ThinLTO).
575580
/// The value's original name is \c Name and has linkage of type
@@ -578,18 +583,23 @@ class GlobalValue : public Constant {
578583
GlobalValue::LinkageTypes Linkage,
579584
StringRef FileName);
580585

586+
private:
581587
/// Return the modified name for this global value suitable to be
582588
/// used as the key for a global lookup (e.g. profile or ThinLTO).
583589
std::string getGlobalIdentifier() const;
584590

585-
/// Declare a type to represent a global unique identifier for a global value.
586-
/// This is a 64 bits hash that is used by PGO and ThinLTO to have a compact
587-
/// unique way to identify a symbol.
588-
using GUID = uint64_t;
589-
590591
/// Return a 64-bit global unique ID constructed from global value name
591592
/// (i.e. returned by getGlobalIdentifier()).
592-
static GUID getGUID(StringRef GlobalName);
593+
static GUID getGUID(StringRef GlobalIdentifier);
594+
595+
public:
596+
/// Return a 64-bit global unique ID constructed from the name of a global
597+
/// symbol. Since this call doesn't supply the linkage or defining filename,
598+
/// the GUID computation will assume that the global has external linkage.
599+
static GUID getGUIDAssumingExternalLinkage(StringRef GlobalName) {
600+
return getGUID(
601+
getGlobalIdentifier(GlobalName, GlobalValue::ExternalLinkage, ""));
602+
}
593603

594604
/// Return a 64-bit global unique ID constructed from global value name
595605
/// (i.e. returned by getGlobalIdentifier()).

llvm/include/llvm/IR/ModuleSummaryIndex.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,13 +1340,13 @@ class CfiFunctionIndex {
13401340
template <typename... Args> void emplace(Args &&...A) {
13411341
StringRef S(std::forward<Args>(A)...);
13421342
GlobalValue::GUID GUID =
1343-
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S));
1343+
GlobalValue::getGUIDAssumingExternalLinkage(GlobalValue::dropLLVMManglingEscape(S));
13441344
Index[GUID].emplace(S);
13451345
}
13461346

13471347
size_t count(StringRef S) const {
13481348
GlobalValue::GUID GUID =
1349-
GlobalValue::getGUID(GlobalValue::dropLLVMManglingEscape(S));
1349+
GlobalValue::getGUIDAssumingExternalLinkage(GlobalValue::dropLLVMManglingEscape(S));
13501350
auto I = Index.find(GUID);
13511351
if (I == Index.end())
13521352
return 0;
@@ -1749,8 +1749,10 @@ class ModuleSummaryIndex {
17491749
/// Add a global value summary for a value of the given name.
17501750
void addGlobalValueSummary(StringRef ValueName,
17511751
std::unique_ptr<GlobalValueSummary> Summary) {
1752-
addGlobalValueSummary(getOrInsertValueInfo(GlobalValue::getGUID(ValueName)),
1753-
std::move(Summary));
1752+
addGlobalValueSummary(
1753+
getOrInsertValueInfo(
1754+
GlobalValue::getGUIDAssumingExternalLinkage(ValueName)),
1755+
std::move(Summary));
17541756
}
17551757

17561758
/// Add a global value summary for the given ValueInfo.
@@ -1887,19 +1889,22 @@ class ModuleSummaryIndex {
18871889
/// This accessor can mutate the map and therefore should not be used in
18881890
/// the ThinLTO backends.
18891891
TypeIdSummary &getOrInsertTypeIdSummary(StringRef TypeId) {
1890-
auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1892+
auto TidIter = TypeIdMap.equal_range(
1893+
GlobalValue::getGUIDAssumingExternalLinkage(TypeId));
18911894
for (auto &[GUID, TypeIdPair] : make_range(TidIter))
18921895
if (TypeIdPair.first == TypeId)
18931896
return TypeIdPair.second;
1894-
auto It = TypeIdMap.insert({GlobalValue::getGUID(TypeId),
1895-
{TypeIdSaver.save(TypeId), TypeIdSummary()}});
1897+
auto It =
1898+
TypeIdMap.insert({GlobalValue::getGUIDAssumingExternalLinkage(TypeId),
1899+
{TypeIdSaver.save(TypeId), TypeIdSummary()}});
18961900
return It->second.second;
18971901
}
18981902

18991903
/// This returns either a pointer to the type id summary (if present in the
19001904
/// summary map) or null (if not present). This may be used when importing.
19011905
const TypeIdSummary *getTypeIdSummary(StringRef TypeId) const {
1902-
auto TidIter = TypeIdMap.equal_range(GlobalValue::getGUID(TypeId));
1906+
auto TidIter = TypeIdMap.equal_range(
1907+
GlobalValue::getGUIDAssumingExternalLinkage(TypeId));
19031908
for (const auto &[GUID, TypeIdPair] : make_range(TidIter))
19041909
if (TypeIdPair.first == TypeId)
19051910
return &TypeIdPair.second;

llvm/include/llvm/IR/ModuleSummaryIndexYAML.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ template <> struct CustomMappingTraits<TypeIdSummaryMapTy> {
314314
static void inputOne(IO &io, StringRef Key, TypeIdSummaryMapTy &V) {
315315
TypeIdSummary TId;
316316
io.mapRequired(Key.str().c_str(), TId);
317-
V.insert({GlobalValue::getGUID(Key), {Key, TId}});
317+
V.insert({GlobalValue::getGUIDAssumingExternalLinkage(Key), {Key, TId}});
318318
}
319319
static void output(IO &io, TypeIdSummaryMapTy &V) {
320320
for (auto &TidIter : V)

llvm/include/llvm/ProfileData/SampleProf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ class FunctionSamples {
12991299
static inline FunctionId getRepInFormat(StringRef Name) {
13001300
if (Name.empty() || !FunctionSamples::UseMD5)
13011301
return FunctionId(Name);
1302-
return FunctionId(Function::getGUID(Name));
1302+
return FunctionId(Function::getGUIDAssumingExternalLinkage(Name));
13031303
}
13041304

13051305
raw_ostream &operator<<(raw_ostream &OS, const FunctionSamples &FS);

llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ class PseudoProbeManager {
109109
}
110110

111111
const PseudoProbeDescriptor *getDesc(StringRef FProfileName) const {
112-
return getDesc(Function::getGUID(FProfileName));
112+
return getDesc(Function::getGUIDAssumingExternalLinkage(FProfileName));
113113
}
114114

115115
const PseudoProbeDescriptor *getDesc(const Function &F) const {
116-
return getDesc(Function::getGUID(FunctionSamples::getCanonicalFnName(F)));
116+
return getDesc(Function::getGUIDAssumingExternalLinkage(
117+
FunctionSamples::getCanonicalFnName(F)));
117118
}
118119

119120
bool profileIsHashMismatched(const PseudoProbeDescriptor &FuncDesc,

llvm/lib/Analysis/CtxProfAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ PreservedAnalyses AssignGUIDPass::run(Module &M, ModuleAnalysisManager &MAM) {
5757
GlobalValue::GUID AssignGUIDPass::getGUID(const Function &F) {
5858
if (F.isDeclaration()) {
5959
assert(GlobalValue::isExternalLinkage(F.getLinkage()));
60-
return GlobalValue::getGUID(F.getGlobalIdentifier());
60+
return F.getGUID();
6161
}
6262
auto *MD = F.getMetadata(GUIDMetadataName);
6363
assert(MD && "guid not found for defined function");

llvm/lib/Analysis/ModuleSummaryAnalysis.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ static void addIntrinsicToSummary(
222222
auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
223223
if (!TypeId)
224224
break;
225-
GlobalValue::GUID Guid = GlobalValue::getGUID(TypeId->getString());
225+
GlobalValue::GUID Guid =
226+
GlobalValue::getGUIDAssumingExternalLinkage(TypeId->getString());
226227

227228
// Produce a summary from type.test intrinsics. We only summarize type.test
228229
// intrinsics that are used other than by an llvm.assume intrinsic.
@@ -250,7 +251,8 @@ static void addIntrinsicToSummary(
250251
auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
251252
if (!TypeId)
252253
break;
253-
GlobalValue::GUID Guid = GlobalValue::getGUID(TypeId->getString());
254+
GlobalValue::GUID Guid =
255+
GlobalValue::getGUIDAssumingExternalLinkage(TypeId->getString());
254256

255257
SmallVector<DevirtCallSite, 4> DevirtCalls;
256258
SmallVector<Instruction *, 4> LoadedPtrs;
@@ -906,7 +908,8 @@ static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A,
906908

907909
// Set LiveRoot flag on entries matching the given value name.
908910
static void setLiveRoot(ModuleSummaryIndex &Index, StringRef Name) {
909-
if (ValueInfo VI = Index.getValueInfo(GlobalValue::getGUID(Name)))
911+
if (ValueInfo VI =
912+
Index.getValueInfo(GlobalValue::getGUIDAssumingExternalLinkage(Name)))
910913
for (const auto &Summary : VI.getSummaryList())
911914
Summary->setLive(true);
912915
}

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9005,7 +9005,7 @@ bool LLParser::parseTypeIdEntry(unsigned ID) {
90059005
for (auto TIDRef : FwdRefTIDs->second) {
90069006
assert(!*TIDRef.first &&
90079007
"Forward referenced type id GUID expected to be 0");
9008-
*TIDRef.first = GlobalValue::getGUID(Name);
9008+
*TIDRef.first = GlobalValue::getGUIDAssumingExternalLinkage(Name);
90099009
}
90109010
ForwardRefTypeIds.erase(FwdRefTIDs);
90119011
}
@@ -9110,7 +9110,7 @@ bool LLParser::parseTypeIdCompatibleVtableEntry(unsigned ID) {
91109110
for (auto TIDRef : FwdRefTIDs->second) {
91119111
assert(!*TIDRef.first &&
91129112
"Forward referenced type id GUID expected to be 0");
9113-
*TIDRef.first = GlobalValue::getGUID(Name);
9113+
*TIDRef.first = GlobalValue::getGUIDAssumingExternalLinkage(Name);
91149114
}
91159115
ForwardRefTypeIds.erase(FwdRefTIDs);
91169116
}
@@ -9423,11 +9423,9 @@ bool LLParser::addGlobalValueToIndex(
94239423

94249424
VI = Index->getOrInsertValueInfo(GV);
94259425
} else {
9426-
assert(
9427-
(!GlobalValue::isLocalLinkage(Linkage) || !SourceFileName.empty()) &&
9428-
"Need a source_filename to compute GUID for local");
9429-
GUID = GlobalValue::getGUID(
9430-
GlobalValue::getGlobalIdentifier(Name, Linkage, SourceFileName));
9426+
assert(GlobalValue::isExternalLinkage(Linkage) &&
9427+
"Cannot compute GUID for local");
9428+
GUID = GlobalValue::getGUIDAssumingExternalLinkage(Name);
94319429
VI = Index->getOrInsertValueInfo(GUID, Index->saveString(Name));
94329430
}
94339431
}

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7218,10 +7218,10 @@ void ModuleSummaryIndexBitcodeReader::setValueGUID(
72187218
StringRef SourceFileName) {
72197219
std::string GlobalId =
72207220
GlobalValue::getGlobalIdentifier(ValueName, Linkage, SourceFileName);
7221-
auto ValueGUID = GlobalValue::getGUID(GlobalId);
7221+
auto ValueGUID = GlobalValue::getGUIDAssumingExternalLinkage(GlobalId);
72227222
auto OriginalNameID = ValueGUID;
72237223
if (GlobalValue::isLocalLinkage(Linkage))
7224-
OriginalNameID = GlobalValue::getGUID(ValueName);
7224+
OriginalNameID = GlobalValue::getGUIDAssumingExternalLinkage(ValueName);
72257225
if (PrintSummaryGUIDs)
72267226
dbgs() << "GUID " << ValueGUID << "(" << OriginalNameID << ") is "
72277227
<< ValueName << "\n";

llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
3434
// Use caching to avoid redundant md5 computation for build speed.
3535
uint64_t &CallerGuid = NameGuidMap[Name];
3636
if (!CallerGuid)
37-
CallerGuid = Function::getGUID(Name);
37+
CallerGuid = Function::getGUIDAssumingExternalLinkage(Name);
3838
uint64_t CallerProbeId = PseudoProbeDwarfDiscriminator::extractProbeIndex(
3939
InlinedAt->getDiscriminator());
4040
ReversedInlineStack.emplace_back(CallerGuid, CallerProbeId);

llvm/lib/CodeGen/PseudoProbeInserter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class PseudoProbeInserter : public MachineFunctionPass {
129129
private:
130130
uint64_t getFuncGUID(Module *M, DILocation *DL) {
131131
auto Name = DL->getSubprogramLinkageName();
132-
return Function::getGUID(Name);
132+
return Function::getGUIDAssumingExternalLinkage(Name);
133133
}
134134

135135
bool ShouldRun = false;

llvm/lib/IR/AsmWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3172,7 +3172,7 @@ void AssemblyWriter::printModuleSummaryIndex() {
31723172

31733173
// Print the TypeIdCompatibleVtableMap entries.
31743174
for (auto &TId : TheIndex->typeIdCompatibleVtableMap()) {
3175-
auto GUID = GlobalValue::getGUID(TId.first);
3175+
auto GUID = GlobalValue::getGUIDAssumingExternalLinkage(TId.first);
31763176
Out << "^" << Machine.getTypeIdCompatibleVtableSlot(TId.first)
31773177
<< " = typeidCompatibleVTable: (name: \"" << TId.first << "\"";
31783178
printTypeIdCompatibleVtableSummary(TId.second);

llvm/lib/IR/Globals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
7373
removeSanitizerMetadata();
7474
}
7575

76-
GlobalValue::GUID GlobalValue::getGUID(StringRef GlobalName) {
77-
return MD5Hash(GlobalName);
76+
GlobalValue::GUID GlobalValue::getGUID(StringRef GlobalIdentifier) {
77+
return MD5Hash(GlobalIdentifier);
7878
}
7979

8080
void GlobalValue::removeFromParent() {

llvm/lib/LTO/LTO.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,9 @@ Error LTO::addThinLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
10381038
SymbolResolution Res = *ResITmp++;
10391039

10401040
if (!Sym.getIRName().empty()) {
1041-
auto GUID = GlobalValue::getGUID(GlobalValue::getGlobalIdentifier(
1042-
Sym.getIRName(), GlobalValue::ExternalLinkage, ""));
1041+
auto GUID = GlobalValue::getGUIDAssumingExternalLinkage(
1042+
GlobalValue::getGlobalIdentifier(Sym.getIRName(),
1043+
GlobalValue::ExternalLinkage, ""));
10431044
if (Res.Prevailing)
10441045
ThinLTO.PrevailingModuleForGUID[GUID] = BM.getModuleIdentifier();
10451046
}
@@ -1059,8 +1060,9 @@ Error LTO::addThinLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
10591060
SymbolResolution Res = *ResI++;
10601061

10611062
if (!Sym.getIRName().empty()) {
1062-
auto GUID = GlobalValue::getGUID(GlobalValue::getGlobalIdentifier(
1063-
Sym.getIRName(), GlobalValue::ExternalLinkage, ""));
1063+
auto GUID = GlobalValue::getGUIDAssumingExternalLinkage(
1064+
GlobalValue::getGlobalIdentifier(Sym.getIRName(),
1065+
GlobalValue::ExternalLinkage, ""));
10641066
if (Res.Prevailing) {
10651067
assert(ThinLTO.PrevailingModuleForGUID[GUID] ==
10661068
BM.getModuleIdentifier());
@@ -1169,7 +1171,7 @@ Error LTO::run(AddStreamFn AddStream, FileCache Cache) {
11691171
if (Res.second.IRName.empty())
11701172
continue;
11711173

1172-
GlobalValue::GUID GUID = GlobalValue::getGUID(
1174+
GlobalValue::GUID GUID = GlobalValue::getGUIDAssumingExternalLinkage(
11731175
GlobalValue::dropLLVMManglingEscape(Res.second.IRName));
11741176

11751177
if (Res.second.VisibleOutsideSummary && Res.second.Prevailing)
@@ -1944,7 +1946,7 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
19441946
if (Res.second.Partition != GlobalResolution::External ||
19451947
!Res.second.isPrevailingIRSymbol())
19461948
continue;
1947-
auto GUID = GlobalValue::getGUID(
1949+
auto GUID = GlobalValue::getGUIDAssumingExternalLinkage(
19481950
GlobalValue::dropLLVMManglingEscape(Res.second.IRName));
19491951
// Mark exported unless index-based analysis determined it to be dead.
19501952
if (ThinLTO.CombinedIndex.isGUIDLive(GUID))

llvm/lib/LTO/ThinLTOCodeGenerator.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ addUsedSymbolToPreservedGUID(const lto::InputFile &File,
295295
DenseSet<GlobalValue::GUID> &PreservedGUID) {
296296
for (const auto &Sym : File.symbols()) {
297297
if (Sym.isUsed())
298-
PreservedGUID.insert(GlobalValue::getGUID(Sym.getIRName()));
298+
PreservedGUID.insert(
299+
GlobalValue::getGUIDAssumingExternalLinkage(Sym.getIRName()));
299300
}
300301
}
301302

@@ -308,8 +309,9 @@ static void computeGUIDPreservedSymbols(const lto::InputFile &File,
308309
// compute the GUID for the symbol.
309310
for (const auto &Sym : File.symbols()) {
310311
if (PreservedSymbols.count(Sym.getName()) && !Sym.getIRName().empty())
311-
GUIDs.insert(GlobalValue::getGUID(GlobalValue::getGlobalIdentifier(
312-
Sym.getIRName(), GlobalValue::ExternalLinkage, "")));
312+
GUIDs.insert(GlobalValue::getGUIDAssumingExternalLinkage(
313+
GlobalValue::getGlobalIdentifier(Sym.getIRName(),
314+
GlobalValue::ExternalLinkage, "")));
313315
}
314316
}
315317

llvm/lib/ProfileData/InstrProf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ Error InstrProfSymtab::addVTableWithName(GlobalVariable &VTable,
517517

518518
bool Inserted = true;
519519
std::tie(std::ignore, Inserted) =
520-
MD5VTableMap.try_emplace(GlobalValue::getGUID(Name), &VTable);
520+
MD5VTableMap.try_emplace(VTable.getGUID(), &VTable);
521521
if (!Inserted)
522522
LLVM_DEBUG(dbgs() << "GUID conflict within one module");
523523
return Error::success();
@@ -635,7 +635,7 @@ Error InstrProfSymtab::addFuncWithName(Function &F, StringRef PGOFuncName,
635635
auto NameToGUIDMap = [&](StringRef Name) -> Error {
636636
if (Error E = addFuncName(Name))
637637
return E;
638-
MD5FuncMap.emplace_back(Function::getGUID(Name), &F);
638+
MD5FuncMap.emplace_back(F.getGUID(), &F);
639639
return Error::success();
640640
};
641641
if (Error E = NameToGUIDMap(PGOFuncName))

llvm/lib/ProfileData/MemProf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ GlobalValue::GUID IndexedMemProfRecord::getGUID(const StringRef FunctionName) {
263263
// We use the function guid which we expect to be a uint64_t. At
264264
// this time, it is the lower 64 bits of the md5 of the canonical
265265
// function name.
266-
return Function::getGUID(CanonicalName);
266+
return Function::getGUIDAssumingExternalLinkage(CanonicalName);
267267
}
268268

269269
Expected<MemProfSchema> readMemProfSchema(const unsigned char *&Buffer) {

llvm/lib/ProfileData/SampleProfReader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles(
908908
DenseSet<uint64_t> FuncGuidsToUse;
909909
if (useMD5()) {
910910
for (auto Name : FuncsToUse)
911-
FuncGuidsToUse.insert(Function::getGUID(Name));
911+
FuncGuidsToUse.insert(Function::getGUIDAssumingExternalLinkage(Name));
912912
}
913913

914914
// For each function in current module, load all context profiles for

llvm/lib/Target/Mips/MipsSEISelDAGToDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void MipsSEDAGToDAGISel::processFunctionAfterISel(MachineFunction &MF) {
176176
case Mips::JAL:
177177
case Mips::JAL_MM:
178178
if (MI.getOperand(0).isGlobal() &&
179-
MI.getOperand(0).getGlobal()->getGlobalIdentifier() == "_mcount")
179+
MI.getOperand(0).getGlobal()->getName() == "_mcount")
180180
emitMCountABI(MI, MBB, MF);
181181
break;
182182
case Mips::JALRPseudo:

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,9 +3138,8 @@ bool PPCAIXAsmPrinter::doInitialization(Module &M) {
31383138
if (Aliasee->hasCommonLinkage()) {
31393139
report_fatal_error("Aliases to common variables are not allowed on AIX:"
31403140
"\n\tAlias attribute for " +
3141-
Alias.getGlobalIdentifier() +
3142-
" is invalid because " + Aliasee->getName() +
3143-
" is common.",
3141+
Alias.getName() + " is invalid because " +
3142+
Aliasee->getName() + " is common.",
31443143
false);
31453144
}
31463145

llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,11 @@ bool SPIRVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
461461
SPIRV::Extension::SPV_KHR_linkonce_odr)
462462
? SPIRV::LinkageType::LinkOnceODR
463463
: SPIRV::LinkageType::Export);
464-
buildOpDecorate(FuncVReg, MIRBuilder, SPIRV::Decoration::LinkageAttributes,
465-
{static_cast<uint32_t>(LnkTy)}, F.getGlobalIdentifier());
464+
buildOpDecorate(
465+
FuncVReg, MIRBuilder, SPIRV::Decoration::LinkageAttributes,
466+
// TODO: is getName a valid substitute here? Is there a linkage type
467+
// included where the name and globalidentifier might be different?
468+
{static_cast<uint32_t>(LnkTy)}, F.getName());
466469
}
467470

468471
// Handle function pointers decoration

0 commit comments

Comments
 (0)