Skip to content

Commit 0cb847a

Browse files
committed
Address review comments.
- Fixed spelling mistake in comment. - Use getInstrProfSectionName instead of hardcoded section names. - Fixup spacing in test to be consitently single spaced.
1 parent c908bba commit 0cb847a

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

compiler-rt/test/profile/AIX/needs-garbage-collection.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
// CHECK-DAG: baz
1111
// CHECK-DAG: get_message
1212

13-
1413
//--- main.c
1514
const char* get_message(void) {
1615
return "Hello World!";
@@ -41,7 +40,6 @@ double bar(void) {
4140
return not_def_two();
4241
}
4342

44-
4543
const char* baz() {
4644
return get_message();
4745
}

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "llvm/MC/MCSymbolXCOFF.h"
6262
#include "llvm/MC/SectionKind.h"
6363
#include "llvm/MC/TargetRegistry.h"
64+
#include "llvm/ProfileData/InstrProf.h"
6465
#include "llvm/Support/Casting.h"
6566
#include "llvm/Support/CodeGen.h"
6667
#include "llvm/Support/Compiler.h"
@@ -254,7 +255,7 @@ class PPCAIXAsmPrinter : public PPCAsmPrinter {
254255
GOAliasMap;
255256

256257
// The __profd_* symbol for the profiling instrumentation data and the
257-
// corresponding __profc_* counters it refernces.
258+
// corresponding __profc_* counters it references.
258259
struct ProfilingSubSection {
259260
MCSectionXCOFF *ProfD;
260261
MCSectionXCOFF *ProfC;
@@ -2984,15 +2985,26 @@ void PPCAIXAsmPrinter::emitSplitSectionPGORefs() {
29842985
MCSymbol *NamesSym = nullptr;
29852986
MCSymbol *VNDSSym = nullptr;
29862987

2988+
auto profSectionName = [](InstrProfSectKind IPSK) -> std::string {
2989+
return getInstrProfSectionName(IPSK, Triple::XCOFF,
2990+
/* AddSegmentInfo */ false);
2991+
};
2992+
29872993
if (OutContext.hasXCOFFSection(
2988-
"__llvm_prf_names",
2989-
XCOFF::CsectProperties(XCOFF::XMC_RO, XCOFF::XTY_SD)))
2990-
NamesSym = OutContext.getOrCreateSymbol("__llvm_prf_names[RO]");
2994+
profSectionName(IPSK_name),
2995+
XCOFF::CsectProperties(XCOFF::XMC_RO, XCOFF::XTY_SD))) {
2996+
std::string SymName = profSectionName(IPSK_name);
2997+
SymName += "[RO]";
2998+
NamesSym = OutContext.getOrCreateSymbol(SymName);
2999+
}
29913000

29923001
if (OutContext.hasXCOFFSection(
2993-
"__llvm_prf_vnds",
2994-
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD)))
2995-
VNDSSym = OutContext.getOrCreateSymbol("__llvm_prf_vnds[RW]");
3002+
profSectionName(IPSK_vnodes),
3003+
XCOFF::CsectProperties(XCOFF::XMC_RW, XCOFF::XTY_SD))) {
3004+
std::string SymName = profSectionName(IPSK_vnodes);
3005+
SymName += "[RW]";
3006+
VNDSSym = OutContext.getOrCreateSymbol(SymName);
3007+
}
29963008

29973009
for (auto SubSections : ProfGenSubSections) {
29983010
MCSectionXCOFF *ProfDCsect = SubSections.ProfD;
@@ -3010,13 +3022,13 @@ void PPCAIXAsmPrinter::emitSplitSectionPGORefs() {
30103022

30113023
// Rename the subsection for the counters
30123024
OutStreamer->emitXCOFFRenameDirective(ProfCCsect->getQualNameSymbol(),
3013-
"__llvm_prf_cnts");
3025+
profSectionName(IPSK_cnts));
30143026
OutStreamer->addBlankLine();
30153027

30163028
// Rename the subsection for the data.
30173029
OutStreamer->switchSection(ProfDCsect);
30183030
OutStreamer->emitXCOFFRenameDirective(ProfDCsect->getQualNameSymbol(),
3019-
"__llvm_prf_data");
3031+
profSectionName(IPSK_data));
30203032
OutStreamer->addBlankLine();
30213033
}
30223034
}

0 commit comments

Comments
 (0)