@@ -450,14 +450,6 @@ int DataAggregator::prepareToParse(StringRef Name, PerfProcessInfo &Process,
450450Error DataAggregator::preprocessProfile (BinaryContext &BC) {
451451 this ->BC = &BC;
452452
453- if (std::optional<StringRef> FileBuildID = BC.getFileBuildID ()) {
454- outs () << " BOLT-INFO: binary build-id is: " << *FileBuildID << " \n " ;
455- processFileBuildID (*FileBuildID);
456- } else {
457- errs () << " BOLT-WARNING: build-id will not be checked because we could "
458- " not read one from input binary\n " ;
459- }
460-
461453 auto ErrorCallback = [](int ReturnCode, StringRef ErrBuf) {
462454 errs () << " PERF-ERROR: return code " << ReturnCode << " \n " << ErrBuf;
463455 exit (1 );
@@ -476,6 +468,14 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
476468 goto heatmap;
477469 }
478470
471+ if (std::optional<StringRef> FileBuildID = BC.getFileBuildID ()) {
472+ outs () << " BOLT-INFO: binary build-id is: " << *FileBuildID << " \n " ;
473+ processFileBuildID (*FileBuildID);
474+ } else {
475+ errs () << " BOLT-WARNING: build-id will not be checked because we could "
476+ " not read one from input binary\n " ;
477+ }
478+
479479 if (BC.IsLinuxKernel ) {
480480 // Current MMap parsing logic does not work with linux kernel.
481481 // MMap entries for linux kernel uses PERF_RECORD_MMAP
@@ -518,13 +518,12 @@ Error DataAggregator::preprocessProfile(BinaryContext &BC) {
518518 deleteTempFiles ();
519519
520520heatmap:
521- if (opts::HeatmapMode) {
522- if (std::error_code EC = printLBRHeatMap ())
523- return errorCodeToError (EC);
524- exit (0 );
525- }
521+ if (!opts::HeatmapMode)
522+ return Error::success ();
526523
527- return Error::success ();
524+ if (std::error_code EC = printLBRHeatMap ())
525+ return errorCodeToError (EC);
526+ exit (0 );
528527}
529528
530529Error DataAggregator::readProfile (BinaryContext &BC) {
0 commit comments