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 script takes the output of ./bin/opt with the flag -print-before-all and chunks it into the separate files by passes. It has a buffer and if it is not zero and the line starts with "*** IR Dump Before", then it is being printed with the annotation (";") to the first line. This logic is missing the very first chunk (chunk-0.ll) and skips it during the annotation as the buffer is empty at this time.
While all the chunk files but the first one would have this written on the top:
; ***IR Dump Before <name of the pass> ....
The first file would not have this line annotated properly:
***IR Dump Before <name of the pass> ....
This creates compilation errors with ./bin/opt .
The extra if-statement ensures that the corner case is covered