summaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/StaticDataProfileInfo.cpp
diff options
context:
space:
mode:
authormingmingl <mingmingl@google.com>2025-10-06 23:45:27 -0700
committermingmingl <mingmingl@google.com>2025-10-07 00:10:26 -0700
commit4ead381c76adfef914463426d72a6e318e833352 (patch)
treed68862e6865c3999a6b2842c1dfbbe70685d43e6 /llvm/lib/Analysis/StaticDataProfileInfo.cpp
parentbc8e67a42de1f2b22cdde0dd186d505d2c15d1ec (diff)
simplify test. The next step is to add debug logusers/mingmingl-llvm/annotator-backupusers/mingmingl-llvm/annotator
Diffstat (limited to 'llvm/lib/Analysis/StaticDataProfileInfo.cpp')
-rw-r--r--llvm/lib/Analysis/StaticDataProfileInfo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/StaticDataProfileInfo.cpp b/llvm/lib/Analysis/StaticDataProfileInfo.cpp
index 700f57000383..7f42d079e1c9 100644
--- a/llvm/lib/Analysis/StaticDataProfileInfo.cpp
+++ b/llvm/lib/Analysis/StaticDataProfileInfo.cpp
@@ -14,6 +14,10 @@ using namespace llvm;
extern cl::opt<bool> AnnotateStaticDataSectionPrefix;
+bool llvm::IsReservedGlobalVariable(const GlobalVariable &GV) {
+ return GV.getName().starts_with("llvm.");
+}
+
void StaticDataProfileInfo::addConstantProfileCount(
const Constant *C, std::optional<uint64_t> Count) {
if (!Count) {
@@ -87,7 +91,8 @@ StringRef StaticDataProfileInfo::getConstantSectionPrefix(
// Module flag `HasDataAccessProf` is 1 -> empty section prefix means
// unknown hotness except for string literals.
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C);
- GV && !GV->getName().starts_with(".str")) {
+ GV && !IsReservedGlobalVariable(*GV) &&
+ !GV->getName().starts_with(".str")) {
auto HotnessFromDAP = getSectionHotnessUsingDAP(GV->getSectionPrefix());
if (!Count) {