[llvm-dev] RFC: FileCheck Enhancements

Daniel Sanders via llvm-dev llvm-dev at lists.llvm.org
Thu May 26 09:09:06 PDT 2016


> 7.  Wildcard for prefixes - If some statements should be checked regardless prefix, it should be used //{{*}}, //{{*}}-NEXT, //{{*}}-SAME and etc.

For this one I agree that multiple check prefixes already provides this. The MIPS tests frequently have something like '--check-prefix=ALL --check-prefix=FOO' on one command and '—check-prefix=ALL –check-prefix=BAR'.

> 8.       Prefix with regular expressions - If statement should be checked if prefix matches some regular expression, it should be used {{regex}}:, {{regex}}-NEXT  and etc.

The previous example isn't very compelling but I can see how this feature could be useful to me. I have a number of tests that do something like:
                // O32:  something for O32
                // N32:  something for N32
                // N64:  something for N64
                // NEW:  something for both N32 and N64
But this is a bit clearer:
                // O32:  something for O32
                // N32:  something for N32
                // N64:  something for N64
                // {{N32|N64}}:  something for both N32 and N64

There's also some that define O32, O32EL, and O32EB which could drop the O32 and do:
                // {{O32(EL|EB)}}: any endian
                // {{O32(EL)}}: little endian
                // {{O32(EB)}}: big endian
In this example, I've included redundant parenthesis so that vim's '*' key can find me all the O32 lines, all the little endian lines, etc.

One last example is that I have some tests that define MIPS32R1, MIPS32R2, MIPS32R3, MIPS32R5, MIPS32R6 and MIPS64 equivalents of each.
                {{MIPS32R[2-5]}} would match MIPS32R2 through to MIPS32R6
                {{MIPS(32|64)R6}} would match MIPS32R6 and MIPS64R6
                {{MIPS64.*}} would match any MIPS64
This would remove a lot of redundancy but it's starting to harm readability. I'm not sure where I draw the line on that trade-off but I definitely wouldn't want complicated regexes.

From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Elena Lepilkina via llvm-dev
Sent: 26 May 2016 16:01
To: James Y Knight; Ehsan Amiri
Cc: llvm-dev
Subject: Re: [llvm-dev] RFC: FileCheck Enhancements

But then I should write
// CHECK: something
// SSE: something
// SSE3: something

With this feature it can be write // {{[A-Z0-9]+}} : something

From: James Y Knight [mailto:jyknight at google.com]
Sent: Thursday, May 26, 2016 5:53 PM
To: Ehsan Amiri <ehsanamiri at gmail.com>
Cc: Elena Lepilkina <Elena.Lepilkina at synopsys.com>; llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] RFC: FileCheck Enhancements



On Thu, May 26, 2016 at 10:35 AM, Ehsan Amiri via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
7.       Wildcard for prefixes - If some statements should be checked regardless prefix, it should be used //{{*}}, //{{*}}-NEXT, //{{*}}-SAME and etc.

8.       Prefix with regular expressions - If statement should be checked if prefix matches some regular expression, it should be used {{regex}}:, {{regex}}-NEXT  and etc.



I, too, think wildcard and regular expression for prefixes will make it hard to read the test files. Currently I can highlight the prefix and focus on a specific test, but that won't be possible when these features are used. I prefer an easy to read but long test file to a hard to read but compact one.


It's also an entirely unnecessary feature: you can use multiple --check-prefix arguments on the test run to accomplish the same thing, and many tests do that today. (e.g. "FileCheck --check-prefix=CHECK --check-prefix=SSE --check-prefix=SSE3").

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160526/da11c54e/attachment.html>


More information about the llvm-dev mailing list