Skip to content

Commit 3f51bec

Browse files
authored
[BOLT][NFC] Print timers in perf2bolt invocation
When BOLT is run in AggregateOnly mode (perf2bolt), it exits with code zero so destructors are not run thus TimerGroup never prints the timers. Add explicit printing just before the exit to honor options requesting timers (`--time-rewrite`, `--time-aggr`). Test Plan: updated bolt/test/timers.c Reviewers: ayermolo, maksfb, rafaelauler, dcci Reviewed By: dcci Pull Request: #101270
1 parent fb97b4f commit 3f51bec

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,6 +3200,7 @@ void RewriteInstance::processProfileData() {
32003200
if (opts::AggregateOnly) {
32013201
PrintProgramStats PPS(&*BAT);
32023202
BC->logBOLTErrorsAndQuitOnFatal(PPS.runOnFunctions(*BC));
3203+
TimerGroup::printAll(outs());
32033204
exit(0);
32043205
}
32053206
}

bolt/test/timers.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
# RUN: link_fdata %s %t.exe %t.fdata
44
# RUN: llvm-bolt %t.exe -o %t.null --data %t.fdata -w %t.yaml --time-rewrite \
55
# RUN: 2>&1 | FileCheck %s
6+
# RUN: link_fdata %s %t.exe %t.preagg PREAGG
7+
# RUN: perf2bolt %t.exe -o %t.null -p %t.preagg --pa --time-rewrite \
8+
# RUN: 2>&1 | FileCheck %s --check-prefix=CHECK-P2B
69
710
# CHECK-DAG: update metadata post-emit
811
# CHECK-DAG: process section metadata
912
# CHECK-DAG: process metadata pre-CFG
1013
# CHECK-DAG: process metadata post-CFG
1114
# CHECK-DAG: finalize metadata pre-emit
1215
16+
# CHECK-P2B-DAG: process section metadata
17+
# CHECK-P2B-DAG: process metadata pre-CFG
18+
1319
# FDATA: 0 [unknown] 0 1 main 0 1 0
20+
# PREAGG: B X:0 #main# 1 0
1421
*/
1522
int main() { return 0; }

0 commit comments

Comments
 (0)