[PATCH] D99994: [CodeView] Add CodeView support for PGO debug information

Michael Holman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 14:07:07 PDT 2021


Holman updated this revision to Diff 336223.
Holman added a comment.

Get PGO info from Module instead of adding new field to debug info.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99994/new/

https://reviews.llvm.org/D99994

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp


Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -804,6 +804,9 @@
   // 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 @@
   if (Asm->TM.getOptLevel() != CodeGenOpt::None &&
       !GV.hasOptSize() && !GV.hasOptNone())
     FPO |= FrameProcedureOptions::OptimizedForSpeed;
+  if (GV.getEntryCount().hasValue()) {
+    FPO |= FrameProcedureOptions::ValidProfileCounts;
+    FPO |= FrameProcedureOptions::ProfileGuidedOptimization;
+  }
   // FIXME: Set GuardCfg when it is implemented.
   CurFn->FrameProcOpts = FPO;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99994.336223.patch
Type: text/x-patch
Size: 1042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210408/9c455ebe/attachment.bin>


More information about the llvm-commits mailing list