aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-10-13 12:02:53 -0700
committerGitHub <noreply@github.com>2025-10-13 19:02:53 +0000
commit13e563e5c60d9d71f8807477b6ecf555037a35bc (patch)
tree25eb8aca4151f703a0dabb9923279e84c36812c3 /llvm/lib/CodeGen
parent9bf88d09b340380c314ca0ccbb1b283fafb96449 (diff)
downloadllvm-13e563e5c60d9d71f8807477b6ecf555037a35bc.zip
llvm-13e563e5c60d9d71f8807477b6ecf555037a35bc.tar.gz
llvm-13e563e5c60d9d71f8807477b6ecf555037a35bc.tar.bz2
[NFCI][StaticDataLayout] Get rid of section prefix validation in codegen (#162349)
The section prefix validation was initially added when global variable's section prefix is only added in the codegen pass. Now the optimizer pass MemProfUse can annotate data section prefix by making use of data access profiles, so we can remove the validation. Also calls `setSectionPrefix` which returns whether section prefix is updated. This is the 3rd patch as a split of https://github.com/llvm/llvm-project/pull/155337
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/StaticDataAnnotator.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/StaticDataAnnotator.cpp b/llvm/lib/CodeGen/StaticDataAnnotator.cpp
index 9b73775..eac20120 100644
--- a/llvm/lib/CodeGen/StaticDataAnnotator.cpp
+++ b/llvm/lib/CodeGen/StaticDataAnnotator.cpp
@@ -78,19 +78,8 @@ bool StaticDataAnnotator::runOnModule(Module &M) {
if (!llvm::memprof::IsAnnotationOK(GV))
continue;
- // The implementation below assumes prior passes don't set section prefixes,
- // and specifically do 'assign' rather than 'update'. So report error if a
- // section prefix is already set.
- if (auto maybeSectionPrefix = GV.getSectionPrefix();
- maybeSectionPrefix && !maybeSectionPrefix->empty())
- llvm::report_fatal_error("Global variable " + GV.getName() +
- " already has a section prefix " +
- *maybeSectionPrefix);
-
StringRef SectionPrefix = SDPI->getConstantSectionPrefix(&GV, PSI);
- if (SectionPrefix.empty())
- continue;
-
+ // setSectionPrefix returns true if the section prefix is updated.
Changed |= GV.setSectionPrefix(SectionPrefix);
}