[llvm] [UpdateTestChecks] Add support for SPIRV in update_llc_test_checks.py (PR #66213)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 19 10:06:22 PDT 2023


arichardson wrote:

> > Maybe something like `"[ \t]+; \-\- Begin function (?P<func>[^\n]+)(?P<func_name_separator>)\n(?P<body>.*?)\n[ \t]+; \-\- End function"` would work? By setting func_name_separator to an empty match the CHECK-LABEL string expansion won't add the default value of ":"? Is that sufficient?
> > ```
> >                     check_label_format
> >                     % (
> >                         checkprefix,
> >                         funcdef_attrs_and_ret,
> >                         func_name,
> >                         args_and_sig,
> >                         func_name_separator,
> >                     )
> > ```
> 
> To be honest, I don't understand the suggestion. I removed - for explanatory purposes - the flag from the commit and regenerated the test. Now the check lines look like:
> 
> ```
> ; CHECK-EXTENSION-LABEL: _Z3foov:
> ; CHECK-EXTENSION:       %4 = OpFunction %2 DontInline %3
> ; CHECK-EXTENSION-NEXT:    %5 = OpLabel
> ; CHECK-EXTENSION-NEXT:    OpReturn
> ; CHECK-EXTENSION-NEXT:    OpFunctionEnd
> ```
> 
> The problem is the *-LABEL line which is not issues at all by SPIRV. It seems you know how to skip this line without having an extra flag but I don't understand what you mean by:
> 
> > the CHECK-LABEL string expansion won't add the default value of ":"?
> 
> By guess at an answer is that this is still not sufficient because there's no label at all to match.


The ':' is added because that's the default value of `func_name_separator` if it's not set by the regex. I was suggesting to include an empty capture in the regex so that `func_name_separator` is set to the empty string instead.

https://github.com/llvm/llvm-project/pull/66213


More information about the llvm-commits mailing list