================ @@ -2769,6 +2769,23 @@ namespace { } // end anonymous namespace +StringRef AsmPrinter::getConstantSectionSuffix(const Constant *C) const { + SmallString<8> SectionNameSuffix; + if (TM.Options.EnableStaticDataPartitioning) { + if (C && SDPI && PSI) { + auto Count = SDPI->getConstantProfileCount(C); + if (Count) { + if (PSI->isHotCount(*Count)) { + SectionNameSuffix.append("hot"); + } else if (PSI->isColdCount(*Count) && !SDPI->hasUnknownCount(C)) { + SectionNameSuffix.append("unlikely"); + } + } + } + } + return SectionNameSuffix.str(); ---------------- snehasish wrote:
This is returning a StringRef whose underlying memory is stack allocated. I don't think you need a SmallString here, just return std::string or c-string and convert it at the callsite? https://github.com/llvm/llvm-project/pull/129781 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits