Skip to content

Commit c1231ad

Browse files
Improve --report_progress_every flag (llvm#64)
Currently, the --report_progress_every flag, even with the default value, will always report progress on the first block. This is not the intended behavior, as no output should be given with the default value. This patch fixes that behavior and also adds a test to ensure that the flag functions as intended in the default value case and in the value-provided case. Not really super critical to functionality, but a little bit annoying to have this.
1 parent 78f6845 commit c1231ad

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

gematria/datasets/convert_bhive_to_llvm_exegesis_input.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ int main(int argc, char* argv[]) {
340340
}
341341
}
342342

343-
if (file_counter % report_progress_every == 0)
343+
if (file_counter != 0 && file_counter % report_progress_every == 0)
344344
std::cerr << "Finished annotating block #" << file_counter << ".\n";
345345

346346
file_counter++;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
; Test that the --report_progress_every reports progress at the expected
2+
; intervals.
3+
4+
; RUN: split-file %s %t
5+
; RUN: mkdir %t.asmdir
6+
; RUN: %convert_bhive_to_llvm_exegesis_input --asm_output_dir=%t.asmdir --bhive_csv=%t/test.csv --report_progress_every=2 2>&1 | FileCheck %s
7+
8+
; CHECK: Finished annotating block #2.
9+
; CHECK: Finished annotating block #4.
10+
11+
; Test that --report_progress_every doesn't output anything with the default
12+
; value.
13+
; RUN: %convert_bhive_to_llvm_exegesis_input --asm_output_dir=%t.asmdir --bhive_csv=%t/test.csv 2>&1 | FileCheck %s --check-prefix=DEFAULT-VALUE
14+
15+
; DEFAULT-VALUE-NOT: Finished annotating block
16+
17+
;--- test.csv
18+
4183ff0119c083e00885c98945c4b8010000000f4fc139c2,298.000000
19+
4889de4889c24c89ff,93.000000
20+
48895d1844886520488945004889e84883c4085b5d415c415d,335.000000
21+
418b4424084d8b3424498d2cc64939ee,98.000000
22+
85c044897c2460,98.000000

0 commit comments

Comments
 (0)