<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Seems to me there was a proposal (possibly years ago now) to allow defining named patterns, from someone who had (IIRC) implemented such a feature in a downstream project. I don’t remember the details of their use-case, but apparently
by itself it wasn’t compelling enough to get the encouragement to proceed.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">FileCheck directives are already easy to get wrong, and adding a command-line option to change their interpretation just seems like asking for trouble. But adding a way to define a pattern that is independent of the input text seems like
it could be useful.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’d suggest that initially at least, the define-a-pattern directive would take only “immediate” text, no embedded regexes. That is, you could do<o:p></o:p></p>
<p class="MsoNormal"> DEFPAT[MYPATTERN]: Define a pattern here<o:p></o:p></p>
<p class="MsoNormal">but you couldn’t do<o:p></o:p></p>
<p class="MsoNormal"> DEFPAT[MYPATTERN]: Define {{some|any}} pattern here<o:p></o:p></p>
<p class="MsoNormal">although it might be reasonable to allow<o:p></o:p></p>
<p class="MsoNormal"> DEFPAT[PATTERN1]: some<o:p></o:p></p>
<p class="MsoNormal"> DEFPAT[PATTERN2]: Define [[PATTERN1]] pattern here<o:p></o:p></p>
<p class="MsoNormal">as the [[]] substitution can be done when the directive is read.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My $.02,<o:p></o:p></p>
<p class="MsoNormal">--paulr<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> George Rimar <grimar@accesssoftek.com> <br>
<b>Sent:</b> Friday, January 31, 2020 5:52 AM<br>
<b>To:</b> Thomas Preud'homme <thomasp@graphcore.ai>; llvm-dev <llvm-dev@lists.llvm.org>; Robinson, Paul <paul.robinson@sony.com>; jh7370.2008@my.bristol.ac.uk<br>
<b>Subject:</b> Re: [RFC][FileCheck] New option to negate check patterns<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><span style="font-size:12.0pt;color:black">Hi all,<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> I feel it might be confusing to have a CHECK becomes effectively a CHECK-NOT,<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> especially if the RUN line is far from the CHECK line (which is often the case when<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> a single RUN line drives several groups of CHECK directives (e.g. code generation<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> tested for several functions for a specific feature, like PIC). You also loose control<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> on where the NOT should be: it would have to be at the same location as the<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">> CHECK even though for the NOT case you might want to check it somewhere else.<o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
<p><span style="font-size:12.0pt;color:black">I think I agree with Thomas. <o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:black">+ the relationship with "</span><span style="font-size:12.0pt;color:#212121;background:white">CHECK-NOT/CHECK-NEXT/CHECK-SAME" </span><span style="font-size:12.0pt;color:#212121">might make things overcomplicated
probably.</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">> How about having a concept of regex variables where you give a name<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">> to a given directive's pattern which you could reuse as another pattern. Something like (syntax TBD):<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">> CHECK<NAME>: mov [[REG:r[0-9]+]], #42<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">> CHECK-NOT: <NAME><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">I.e. without adding a new optinons for </span><span style="font-size:12.0pt;color:#212121;background:white">FileCheck</span><span style="font-size:12.0pt;color:black">, something like the following?<o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --print-string | FileCheck %s --check-prefix=CHECK1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --no-print-string | FileCheck %s --check-prefix=<span style="background:white">CHECK2</span><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black;background:white">CHECK1<NAME>: mov [[REG:r[0-9]+]], #42</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black;background:white">CHECK2-NOT: <NAME></span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">It might work probably. We already have the ability to name parts of<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">the output checked:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">// CHECK: Dynamic Relocations {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">// CHECK-NEXT: {{.*}} R_AARCH64_RELATIVE - [[BAR_ADDR:.*]]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">// CHECK: Symbols [<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">// CHECK-NEXT: Value: [[BAR_ADDR]]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">So adding a way for naming the whole line does not look<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">an unreasonable/inconsistent extention to me I think.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Best regards,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">George | Developer | Access Softek, Inc<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;color:#212121">
<hr size="2" width="98%" align="center">
</span></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> James Henderson <jh7370.2008@my.bristol.ac.uk><br>
<b>Sent:</b> 31 January 2020 09:14<br>
<b>To:</b> llvm-dev <llvm-dev@lists.llvm.org>; Thomas Preud'homme <thomasp@graphcore.ai>; Paul Robinson <paul.robinson@sony.com>; George Rimar <grimar@accesssoftek.com><br>
<b>Subject:</b> [RFC][FileCheck] New option to negate check patterns</span><span style="font-size:12.0pt;color:#212121">
<o:p></o:p></span></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"> <o:p></o:p></span></p>
</div>
</div>
<div>
<p><span style="font-size:12.0pt;color:#212121;background:#FFEB9C"> [This message was sent from somebody outside of your organisation] </span><span style="font-size:12.0pt;color:#212121"><o:p></o:p></span></p>
<p><span style="font-size:12.0pt;color:#212121"> <o:p></o:p></span></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">Hi all,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">There have been a few cases recently where I've noticed two test cases in the same lit test that do the same thing except invert the CHECK, to show that something is NOT present. I'm talking
about something like the following:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --print-string | FileCheck %s --check-prefix=STRING<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --no-print-string | FileCheck %s --check-prefix=NO-STRING<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># STRING: This is the string<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># NO-STRING-NOT: This is the string<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">In such cases, as can be seen, the CHECK line effectively has to be duplicated (either in an explicit check like in the above example, or via --implicit-check-not). Duplication is generally bad,
especially in this sort of case, as it only takes a typo in the NOT pattern, or a careless developer/reviewer pair changing the output to cause the NOT pattern to no longer be useful.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">I'd like to propose a new FileCheck option (e.g. --check-not-prefix/--check-not-prefixes) which allows implicitly converting a check prefix to a -NOT version of the same prefix. That would allow
writing the above example as:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --print-string | FileCheck %s --check-prefix=STRING<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># RUN: llvm-sometool --no-print-string | FileCheck %s --check-not-prefix=STRING<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"># STRING: This is the string<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">If there was a typo or somebody changed the string output, this mechanism would ensure there is no chance of the pattern rotting.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">Caveat: I don't know what would be the appropriate way of handling non-trivial checks, i.e. existing CHECK-NOT/CHECK-NEXT/CHECK-SAME etc. I'd appreciate any ideas on this.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">Thoughts?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121">James<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:#212121"><br>
<br>
</span><span style="font-size:7.5pt;color:#212121">** We have updated our privacy policy, which contains important information about how we collect and process your personal data. To read the policy, please click
<a href="http://www.graphcore.ai/privacy">here</a> **<br>
<br>
This email and its attachments are intended solely for the addressed recipients and may contain confidential or legally privileged information.<br>
If you are not the intended recipient you must not copy, distribute or disseminate this email in any way; to do so may be unlawful.<br>
<br>
Any personal data/special category personal data herein are processed in accordance with UK data protection legislation.<br>
All associated feasible security measures are in place. Further details are available from the Privacy Notice on the website and/or from the Company.<br>
<br>
Graphcore Limited (registered in England and Wales with registration number 10185006) is registered at 107 Cheapside, London, UK, EC2V 6DN.<br>
This message was scanned for viruses upon transmission. However Graphcore accepts no liability for any such transmission.</span><span style="font-size:12.0pt;color:#212121"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>