<div dir="ltr">I'd probably have expected the behavior it has - that -DAG and -NOT are not ordered with respect to each other, and form a bag of things ordered with respect to enclosing CHECK:s.<br><br>If you want to try turning it into an error, you could find all the places we do use interspersed -DAG and -NOT and have a discussion about whether they're more buggy than they are useful/correct.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 7, 2016 at 5:39 PM, Robinson, Paul via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If you look at the FileCheck documentation page:<br>
<a href="http://llvm.org/docs/CommandGuide/FileCheck.html" rel="noreferrer" target="_blank">http://llvm.org/docs/CommandGuide/FileCheck.html</a><br>
you'll find this intriguing example of combining -DAG with -NOT<br>
(slightly amended to avoid some potential confusion):<br>
<br>
; CHECK-DAG: BEFORE<br>
; CHECK-NOT: BETWEEN<br>
; CHECK-DAG: AFTER<br>
<br>
The page says this will reject the sequence "AFTER BEFORE", which is<br>
correct.  It's intuitively obvious that it will also reject the text<br>
"BEFORE BETWEEN AFTER" as well.<br>
<br>
Pop Quiz:  Will it accept or reject "BEFORE AFTER BETWEEN"?<br>
No, don't go try it, that's cheating; what do you *think* will happen?<br>
Take a minute, I won't mind.<br>
---<br>
<br>
So, here's the story.<br>
<br>
Normally a -NOT line will scan the text between the points where the<br>
preceding and following CHECK lines match.  By that mental model, you'd<br>
expect the first -DAG to find BEFORE, the second -DAG to find AFTER, and<br>
then -NOT would verify the absence of "BETWEEN" between those two points.<br>
All very intuitive, and I've certainly seen tests written to expect that.<br>
<br>
However, things get a little funky when you have -NOT followed by -DAG.<br>
What's the endpoint of the -NOT search?  The thing that follows isn't<br>
a CHECK, it's a CHECK-DAG, except that -NOT is already kind of DAG-ish<br>
so you have two DAG-ish groups staring at each other wondering who will<br>
go first.<br>
<br>
In this case, turns out, it's the -NOT who blinks first.  The endpoint<br>
of the search is implicitly the end-of-input.  The Pop Quiz answer is:<br>
*Rejected.*  The BETWEEN occurs after BEFORE, and before the end-of-input.<br>
<br>
Here's the real question:  *Should* FileCheck run the second -DAG group<br>
before it runs the -NOT group?  Then the range for the -NOT would be<br>
bounded by the matching points for the surrounding -DAG lines, which<br>
probably matches what basically everybody expects to happen.<br>
<br>
Or, leave things as they are, and add a cautionary tale to the FileCheck<br>
documentation page?  Given there's an actual documentation example, it<br>
would seem inappropriate to make it an *error* if a -NOT is followed<br>
by a -DAG!<br>
<br>
Thanks,<br>
--paulr<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>