Add pass number to dot dump filename

Summary:
Change .dot dumps filename format from
  <function>-<passname>.dot
to
  <function>-<passidx>_<passname>.dot
This change helps navigate dumps by making the pass order explicit.
Example:
  execute_stack_op.cold.6-1(*2)-00_build-cfg.dot
  execute_stack_op.cold.6-1(*2)-01_validate-internal-calls.dot
  execute_stack_op.cold.6-1(*2)-02_strip-rep-ret.dot
  ...

(cherry picked from FBD24452903)
This commit is contained in:
Amir Ayupov 2020-10-21 17:08:32 -07:00 committed by Maksim Panchenko
parent d91add0bfe
commit 5f2f96c4c9
2 changed files with 6 additions and 3 deletions

View File

@ -29,6 +29,7 @@
#include "Passes/StokeInfo.h"
#include "Passes/ValidateInternalCalls.h"
#include "Passes/VeneerElimination.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <numeric>
@ -319,11 +320,13 @@ const char BinaryFunctionPassManager::TimerGroupDesc[] =
void BinaryFunctionPassManager::runPasses() {
auto &BFs = BC.getBinaryFunctions();
for (const auto &OptPassPair : Passes) {
for (size_t PassIdx = 0; PassIdx < Passes.size(); PassIdx++) {
const auto &OptPassPair = Passes[PassIdx];
if (!OptPassPair.first)
continue;
auto &Pass = OptPassPair.second;
auto PassIdName = formatv("{0:2}_{1}", PassIdx, Pass->getName()).str();
if (opts::Verbosity > 0) {
outs() << "BOLT-INFO: Starting pass: " << Pass->getName() << "\n";
@ -372,7 +375,7 @@ void BinaryFunctionPassManager::runPasses() {
Function.print(outs(), Message, true);
if (opts::DumpDotAll)
Function.dumpGraphForPass(Pass->getName());
Function.dumpGraphForPass(PassIdName);
}
}
}

View File

@ -2841,7 +2841,7 @@ void RewriteInstance::postProcessFunctions() {
Function.print(outs(), "after building cfg", true);
if (opts::DumpDotAll)
Function.dumpGraphForPass("build-cfg");
Function.dumpGraphForPass("00_build-cfg");
if (opts::PrintLoopInfo) {
Function.calculateLoopInfo();