[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
This commit is contained in:
Kirill Naumov 2020-03-20 15:26:30 +00:00
parent ab64fd39d2
commit 6f85ec960b
1 changed files with 4 additions and 3 deletions

View File

@ -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);