From dc9c7f5391240b763ffb37276ac3c7f2ebec94bb Mon Sep 17 00:00:00 2001 From: dbakunevich Date: Tue, 7 Mar 2023 17:34:00 +0700 Subject: [PATCH] [Tools] Changed the number printing format for sorting As part of this patch, I added the ability to add leading zeros. This is necessary so that the generated files are sorted in ascending order. Reviewed By: yrouban Differential Revision: https://reviews.llvm.org/D145484 --- llvm/utils/chunk-print-before-all.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/chunk-print-before-all.py b/llvm/utils/chunk-print-before-all.py index 251c789..b5756c5 100755 --- a/llvm/utils/chunk-print-before-all.py +++ b/llvm/utils/chunk-print-before-all.py @@ -19,7 +19,7 @@ def get_pass_name(line, prefix): def print_chunk(lines, prefix, pass_name): global chunk_id - fname = str(chunk_id) + "-" + prefix + "-" + pass_name + ".ll" + fname = str(chunk_id).zfill(4) + "-" + prefix + "-" + pass_name + ".ll" chunk_id = chunk_id + 1 print("writing chunk " + fname + " (" + str(len(lines)) + " lines)") with open(fname, "w") as f: -- 2.7.4