[PATCH] D69701: [Utils] Allow "on-the-fly" argument changes for update_test_check scripts

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 1 09:09:21 PDT 2019


jdoerfert marked an inline comment as done.
jdoerfert added a comment.

In D69701#1729845 <https://reviews.llvm.org/D69701#1729845>, @davezarzycki wrote:

> In D69701#1729829 <https://reviews.llvm.org/D69701#1729829>, @arichardson wrote:
>
> > This seems useful, thanks! Another case that would be nice is if there was a way to keep comments inside the autogenerated CHECK lines.
> >
> > For example:
> >
> >   ; CHECK-NEXT: ...
> >   ;; We generate a foo instruction and not a bar instruction here because...
> >   ; CHECK-NEXT: foo a, b, c
> >   ; CHECK-NEXT: ...
> >
> >
> > Right now if you re-run the update script the comment will be moved after all the CHECK lines. I wonder if there is a way to keep inline comments (maybe only if the CHECK: lines before and after didn't change?). Would this work with the `UTC_ARGS: --turn off` method?
>


It would not. The generation still happens in bulk. See below.

> IMHO, that kind of comment belongs with the code that *generates* the output, rather than buried in the middle of a random test file. Separably, if it isn't clear what the test is testing, then perhaps some discussion at the top of the file/function seems appropriate, perhaps with links back to the relevant files/functions that are being tested. For example: "Please see the discussion inside of function `foo` in Bar.cpp for what is being tested below."

There are multiple use cases here for sure and the script addresses only one:
 You generate check lines with the script, then you modify some of them for some reason. (Or you insert a test with manual check in lines into a file that has automatically generated ones.)
With this change you can "protect" the manual check lines in a reasonable way so we can rerun the script on files with the NOTE line.



================
Comment at: llvm/utils/UpdateTestChecks/common.py:53
+UTC_ARGS_KEY = 'UTC_ARGS:'
+UTC_ARGS_CMD = re.compile(r'.*' + UTC_ARGS_KEY + '\s*(?P<cmd>.*)\s*$')
 
----------------
arichardson wrote:
> I think you need a `r` for the second string as well since otherwise newer python will complain that `\s` is not a valid escape sequence.
agreed


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69701/new/

https://reviews.llvm.org/D69701





More information about the llvm-commits mailing list