Clean up external users of GlobalValue::getGUID(StringRef) (#129644)
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: * 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. There are a few cases where neither 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.
This commit is contained in:
@@ -147,7 +147,7 @@ void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) {
|
||||
if (!Name)
|
||||
continue;
|
||||
SymName = *Name;
|
||||
uint64_t GUID = Function::getGUID(SymName);
|
||||
uint64_t GUID = Function::getGUIDAssumingExternalLinkage(SymName);
|
||||
FuncStartAddrs[GUID] = F->getAddress();
|
||||
if (ProfiledOnly && HasProfile)
|
||||
GuidFilter.insert(GUID);
|
||||
@@ -173,7 +173,7 @@ void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) {
|
||||
const GUIDProbeFunctionMap &GUID2Func = ProbeDecoder.getGUID2FuncDescMap();
|
||||
// Checks GUID in GUID2Func and returns it if it's present or null otherwise.
|
||||
auto checkGUID = [&](StringRef SymName) -> uint64_t {
|
||||
uint64_t GUID = Function::getGUID(SymName);
|
||||
uint64_t GUID = Function::getGUIDAssumingExternalLinkage(SymName);
|
||||
if (GUID2Func.find(GUID) == GUID2Func.end())
|
||||
return 0;
|
||||
return GUID;
|
||||
@@ -435,7 +435,7 @@ void PseudoProbeRewriter::encodePseudoProbes() {
|
||||
for (const BinaryFunction *F : BC.getAllBinaryFunctions()) {
|
||||
const uint64_t Addr =
|
||||
F->isEmitted() ? F->getOutputAddress() : F->getAddress();
|
||||
FuncStartAddrs[Function::getGUID(
|
||||
FuncStartAddrs[Function::getGUIDAssumingExternalLinkage(
|
||||
NameResolver::restore(F->getOneName()))] = Addr;
|
||||
}
|
||||
DummyDecoder.buildAddress2ProbeMap(
|
||||
|
||||
Reference in New Issue
Block a user