[llvm] dc9c7f5 - [Tools] Changed the number printing format for sorting

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 00:35:36 PDT 2023


Author: dbakunevich
Date: 2023-03-17T14:35:12+07:00
New Revision: dc9c7f5391240b763ffb37276ac3c7f2ebec94bb

URL: https://github.com/llvm/llvm-project/commit/dc9c7f5391240b763ffb37276ac3c7f2ebec94bb
DIFF: https://github.com/llvm/llvm-project/commit/dc9c7f5391240b763ffb37276ac3c7f2ebec94bb.diff

LOG: [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

Added: 
    

Modified: 
    llvm/utils/chunk-print-before-all.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/chunk-print-before-all.py b/llvm/utils/chunk-print-before-all.py
index 251c78929572..b5756c59c271 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:


        


More information about the llvm-commits mailing list