[PATCH] D56789: Allow CHECK-SAME, NEXT and EMPTY after CHECK-DAG

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 23 12:36:26 PST 2019


jdenny added a comment.

Hi Thomas,

Thanks for working to clean up this area.

As I understand it, `CHECK-NEXT`, `CHECK-SAME`, and `CHECK-EMPTY` currently can appear after non-initial `CHECK-DAG` blocks, and this patch intends to permit them after initial `CHECK-DAG` blocks as well.  I agree with Paul that the title should be adjusted to reflect that.

However, I remember some disagreement in the past as to whether these directives should be permitted after any `CHECK-DAG` at all.  We should probably resolve any remaining disagreement before relaxing things further.

Consider the example that this patch adds to the docs:

  // CHECK-DAG: mov r0, #0
  // CHECK-DAG: mov r1, #1
  // CHECK-NEXT: add r2, r0, r1

Unmatched lines are permitted to appear between `CHECK-DAG` matches, but unmatched lines are not permitted to appear between whichever `CHECK-DAG` match happens to occur last and the `CHECK-NEXT` match.  Is that a realistic use case?

A realistic use case would probably involve something like a `CHECK-DAG-NEXT` directive that doesn't permit intervening lines anywhere in the block.  Or should the above example actually indicate exactly that?

Do you have a use case from a real test to inform this discussion?



================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:252
 newline between it and the previous directive.  A "``CHECK-NEXT:``" cannot be
-the first directive in a file.
+the first positive directive (ie. if removing all "``CHECK-NOT``" directives)
+in a file.
----------------
"ie." -> "i.e.,"

If "ie." is common in some context, please give me a pointer.


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:281
 it and the previous directive.  A "``CHECK-SAME:``" cannot be the first
-directive in a file.
+positive directive (ie. if removing all "``CHECK-NOT``" directives) in a file.
+
----------------
"ie." -> "i.e.,"


================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:449
+``CHECK-EMPTY`` directive, those will search relative to the DAG directive that
+matches last in the input file. In other word:
+
----------------
"word" -> "words"


================
Comment at: llvm/lib/Support/FileCheck.cpp:846
+    // Verify that CHECK-NEXT/SAME/EMPTY lines have at least one positive CHECK
+    // line (ie. something else than CHECK-NOT) before them.
     if ((CheckTy == Check::CheckNext || CheckTy == Check::CheckSame ||
----------------
"ie." -> "i.e.,"


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56789





More information about the llvm-commits mailing list