diff options
author | Michael Holman <michael.holman@microsoft.com> | 2021-04-21 15:29:19 -0700 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2021-04-21 15:29:19 -0700 |
commit | 77357208c46a08b5b90729125236b52256209359 (patch) | |
tree | 6f02a29695a62e0f271fe3ba7b0e7d49482c9c22 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | c4a83c4e69f1c858df787723df4923c41a23e00d (diff) | |
download | llvm-77357208c46a08b5b90729125236b52256209359.zip llvm-77357208c46a08b5b90729125236b52256209359.tar.gz llvm-77357208c46a08b5b90729125236b52256209359.tar.bz2 |
[CodeView] Add CodeView support for PGO debug information
This change adds debug information about whether PGO is being used or
not.
Microsoft performance tooling (e.g. xperf, WPA) uses this information to
show whether functions are optimized with PGO or not, as well as whether
PGO information is invalid.
This information is useful for validating whether training scenarios are
providing good coverage of real world scenarios, showing if profile data
is out of date, etc.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D99994
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 936ac5a..b3f1b95 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -804,6 +804,9 @@ void CodeViewDebug::emitCompilerInformation() { // The low byte of the flags indicates the source language. Flags = MapDWLangToCVLang(CU->getSourceLanguage()); // TODO: Figure out which other flags need to be set. + if (MMI->getModule()->getProfileSummary(/*IsCS*/ false) != nullptr) { + Flags |= static_cast<uint32_t>(CompileSym3Flags::PGO); + } OS.AddComment("Flags and language"); OS.emitInt32(Flags); @@ -1428,6 +1431,10 @@ void CodeViewDebug::beginFunctionImpl(const MachineFunction *MF) { if (Asm->TM.getOptLevel() != CodeGenOpt::None && !GV.hasOptSize() && !GV.hasOptNone()) FPO |= FrameProcedureOptions::OptimizedForSpeed; + if (GV.hasProfileData()) { + FPO |= FrameProcedureOptions::ValidProfileCounts; + FPO |= FrameProcedureOptions::ProfileGuidedOptimization; + } // FIXME: Set GuardCfg when it is implemented. CurFn->FrameProcOpts = FPO; |