[llvm] 6f85ec9 - [Tools] Fixed bug with llvm/utils/chunk-print-before-all.py script.

Kirill Naumov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 15:25:10 PDT 2020


Author: Kirill Naumov
Date: 2020-04-09T22:24:55Z
New Revision: 6f85ec960be44b09d471f8b93e01c22009ff5ed2

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

LOG: [Tools] Fixed bug with llvm/utils/chunk-print-before-all.py script.

Prior to the fix, the script was not annotating the first line of
chunk-0.ll. Because of that, a compilation with ./bin/opt was failing.

The extra if-statement ensures that the corner case is covered

Reviewed-By: apilipenko

Differential Revision: https://reviews.llvm.org/D76507

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 b036e380ef9f..d17bae85cdd3 100755
--- a/llvm/utils/chunk-print-before-all.py
+++ b/llvm/utils/chunk-print-before-all.py
@@ -24,9 +24,10 @@ def print_chunk(lines):
 is_dump = False
 cur = []
 for line in sys.stdin:
-    if line.startswith("*** IR Dump Before ") and len(cur) != 0:
-        print_chunk(cur);
-        cur = []
+    if line.startswith("*** IR Dump Before "):
+        if len(cur) != 0:
+            print_chunk(cur);
+            cur = []
         cur.append("; " + line)
     elif line.startswith("Stack dump:"):
         print_chunk(cur);


        


More information about the llvm-commits mailing list