This is an archive of the discontinued LLVM Phabricator instance.

update_mir_test_checks.py doesn't separate different prefix checks #63112
ClosedPublic

Authored by eddiep24 on Jun 6 2023, 7:42 PM.

Details

Summary

I looked through the update_llc_test_checks.py to see how the spacing is handled between prefixes. In the update_llc_test_checks.py case, the common.py file is called. More specifically, after every prefix group, the following line adds a space between comments:

if is_backend:

if len(printed_prefixes) != 0:
       output_lines.append(comment_marker)

After looking at update_mir_test_checks.py, I saw that the following three lines were commented out:

if printed_prefixes:

  1. Add some space between different check prefixes. output_lines.append('')

After uncommenting the code and running the code on several test files, the comment indeed indicated the correct purpose of the code.

Diff Detail

Event Timeline

eddiep24 created this revision.Jun 6 2023, 7:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 7:42 PM
eddiep24 requested review of this revision.Jun 6 2023, 7:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2023, 7:42 PM
RKSimon added a subscriber: RKSimon.Jun 7 2023, 1:53 AM

Please can you include the diff on some test files - the llvm-project\llvm\test\CodeGen\X86\GlobalISel\legalize-add* files might be a good example

By the looks of it repeatedly running the script on a file adds newlines at the top of each function's set of checks? These shouldn't occur

llvm/utils/update_mir_test_checks.py
240

ideally this would be an indented ';' and not just an empty line

This comment was removed by eddiep24.
eddiep24 updated this revision to Diff 529372.Jun 7 2023, 11:02 AM

The lines at the top were being made because the should_add_line_to_output(input_line, prefix_set) function was skipping check lines but not the comments. Thus, the comments were getting pushed to the top. My solution was to ignore comments in the same fashion and use the previous line in the output_lines array to identify the correct indentation. Thanks for the feedback on the previous diff :). Attached are the diffs for the tests you recommended. They worked out nicely.

Thanks @eddiep24 - that works for me

Do you need to update llvm-project\llvm\test\tools\UpdateTestChecks\update_mir_test_checks\Inputs\x86-multiple-prefixes.ll.expected ? I think it now needs a ';' line in the zero128() test?

eddiep24 updated this revision to Diff 537329.Jul 5 2023, 6:06 AM

Hey Simon, thanks for the heads up. I ran the script and inserted the comment where it needed to go.

RKSimon accepted this revision.Jul 5 2023, 8:24 AM

LGTM, cheers - if you don't have commit access please post your full name / email here and I'll push it for you.

This revision is now accepted and ready to land.Jul 5 2023, 8:24 AM

Awesome:
Eddie Phillips (eddiephillips101@gmail.com)

This revision was landed with ongoing or failed builds.Jul 6 2023, 3:51 AM
This revision was automatically updated to reflect the committed changes.