diff options
author | Mingming Liu <mingmingl@google.com> | 2025-09-16 13:33:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-16 20:33:29 +0000 |
commit | 8b3c91c4fb1b8efaccb71894684e4fb16b0e8945 (patch) | |
tree | 898384a65337cf228cf2cf8325952d01cc8736c0 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | f15fbd1e9e90f0d639d7283c64ee08f9cd2d0e31 (diff) | |
download | llvm-8b3c91c4fb1b8efaccb71894684e4fb16b0e8945.zip llvm-8b3c91c4fb1b8efaccb71894684e4fb16b0e8945.tar.gz llvm-8b3c91c4fb1b8efaccb71894684e4fb16b0e8945.tar.bz2 |
Re-apply "[NFCI][Globals] In GlobalObjects::setSectionPrefix, do conditional update if existing prefix is not equivalent to the new one. Returns whether prefix changed." (#159161)
This is a reland of https://github.com/llvm/llvm-project/pull/158460
Test failures are gone once I undo the changes in codegenprepare.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 9db4c9e..a190f0d 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -583,23 +583,23 @@ bool CodeGenPrepare::_run(Function &F) { // if requested. if (BBSectionsGuidedSectionPrefix && BBSectionsProfileReader && BBSectionsProfileReader->isFunctionHot(F.getName())) { - F.setSectionPrefix("hot"); + (void)F.setSectionPrefix("hot"); } else if (ProfileGuidedSectionPrefix) { // The hot attribute overwrites profile count based hotness while profile // counts based hotness overwrite the cold attribute. // This is a conservative behabvior. if (F.hasFnAttribute(Attribute::Hot) || PSI->isFunctionHotInCallGraph(&F, *BFI)) - F.setSectionPrefix("hot"); + (void)F.setSectionPrefix("hot"); // If PSI shows this function is not hot, we will placed the function // into unlikely section if (1) PSI shows this is a cold function, or // (2) the function has a attribute of cold. else if (PSI->isFunctionColdInCallGraph(&F, *BFI) || F.hasFnAttribute(Attribute::Cold)) - F.setSectionPrefix("unlikely"); + (void)F.setSectionPrefix("unlikely"); else if (ProfileUnknownInSpecialSection && PSI->hasPartialSampleProfile() && PSI->isFunctionHotnessUnknown(F)) - F.setSectionPrefix("unknown"); + (void)F.setSectionPrefix("unknown"); } /// This optimization identifies DIV instructions that can be |