This is an archive of the discontinued LLVM Phabricator instance.

Bug in llvm/utils/print-before-all.py script, fails to compile chunk-0.ll
ClosedPublic

Authored by knaumov on Mar 20 2020, 8:47 AM.

Details

Summary

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

Diff Detail

Event Timeline

knaumov created this revision.Mar 20 2020, 8:47 AM

Can you please elaborate what is the issue you are solving? May be give an example?

It's not very clear to me from the description of the patch.

knaumov edited the summary of this revision. (Show Details)Apr 7 2020, 5:35 PM
apilipenko accepted this revision.Apr 9 2020, 1:27 PM
This revision is now accepted and ready to land.Apr 9 2020, 1:27 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 9 2020, 3:30 PM