[PATCH] D143311: [MLGO] Add BB Profile Dump Pass for Regalloc Case

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 08:59:19 PST 2023


mtrofin added a comment.

Thanks for doing this, looks so much simpler - basically ready to go imho after addressing the error handling comment



================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:363
       MAI->doesDwarfUseRelocationsAcrossSections();
+  if (!BasicBlockProfileDump.empty()) {
+    std::error_code PossibleFileError;
----------------
do this in doInitialize() because then you have a `LLVMContext` which you can use to `emitError` instead of `errs()`


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:377
          "Debug/EH info didn't get finalized");
+  if(MBBProfileDumpFileOutput) {
+    MBBProfileDumpFileOutput->close();
----------------
well, for symmetry, do this in doFinalize. Although IIUC the dtor of raw_fd_ostream would close, too, so you could just skip this.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1889
+  // MBB profile information has been set
+  if (!BasicBlockProfileDump.empty()) {
+    MachineBlockFrequencyInfo &MBFI =
----------------
nit: maybe test on if `MBBProfileDumpFileOutput` instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143311



More information about the llvm-commits mailing list