aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
diff options
context:
space:
mode:
authorOwen Rodley <orodley@google.com>2025-04-28 11:09:43 +1000
committerGitHub <noreply@github.com>2025-04-28 11:09:43 +1000
commitd3d856ad84698fa4ec66177d00558b2f5b438d3b (patch)
tree6d5c57efc1dde6d5fe3afb0af55014916b3d6ec9 /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
parented3c8702a2582d4a8bbd9a292f6a191c0a656775 (diff)
downloadllvm-d3d856ad84698fa4ec66177d00558b2f5b438d3b.zip
llvm-d3d856ad84698fa4ec66177d00558b2f5b438d3b.tar.gz
llvm-d3d856ad84698fa4ec66177d00558b2f5b438d3b.tar.bz2
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.
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 4b50f1e..0227669 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -222,7 +222,8 @@ static void addIntrinsicToSummary(
auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
if (!TypeId)
break;
- GlobalValue::GUID Guid = GlobalValue::getGUID(TypeId->getString());
+ GlobalValue::GUID Guid =
+ GlobalValue::getGUIDAssumingExternalLinkage(TypeId->getString());
// Produce a summary from type.test intrinsics. We only summarize type.test
// intrinsics that are used other than by an llvm.assume intrinsic.
@@ -250,7 +251,8 @@ static void addIntrinsicToSummary(
auto *TypeId = dyn_cast<MDString>(TypeMDVal->getMetadata());
if (!TypeId)
break;
- GlobalValue::GUID Guid = GlobalValue::getGUID(TypeId->getString());
+ GlobalValue::GUID Guid =
+ GlobalValue::getGUIDAssumingExternalLinkage(TypeId->getString());
SmallVector<DevirtCallSite, 4> DevirtCalls;
SmallVector<Instruction *, 4> LoadedPtrs;
@@ -904,7 +906,8 @@ static void computeAliasSummary(ModuleSummaryIndex &Index, const GlobalAlias &A,
// Set LiveRoot flag on entries matching the given value name.
static void setLiveRoot(ModuleSummaryIndex &Index, StringRef Name) {
- if (ValueInfo VI = Index.getValueInfo(GlobalValue::getGUID(Name)))
+ if (ValueInfo VI =
+ Index.getValueInfo(GlobalValue::getGUIDAssumingExternalLinkage(Name)))
for (const auto &Summary : VI.getSummaryList())
Summary->setLive(true);
}