[PATCH][RFC] Add 'CHECK-<N>' directive in FileCheck

Michael Liao michael.liao at intel.com
Tue Apr 30 09:52:37 PDT 2013


Ping with patch re-attached. - Michael

On Mon, 2013-04-29 at 12:06 -0700, Michael Liao wrote:
> Hi,
> 
> As the usage of 'grep' in regression tests is deprecated [1], the
> attached patch proposes adding 'CHECK-<N>' to cover one usage of 'grep',
> i.e. 'grep <pat> | count <N>' which check there are exactly <N>
> occurrences of <pat> in the input string.
> 
> Technically, it's possible to do that *without* introducing a new
> directive. For example, to verify there are exactly 2 occurrences of
> 'movmsk' in the input string, a test could be written like this:
> 
> ; CHECK: movmsk
> ; CHECK: movmsk
> ; CHECK-NOT: movmsk
> 
> Semantically, it means it will check up to two occurrences of 'movmsk'
> and check, after that, there's no occurrence of 'movmsk' till EOF. That
> just means there are exactly 2 occurrences of ''movmsk''. But, when <N>
> is a large number, 'CHECK-<N>' is much more convenient and explicit to
> put the intention to check <N> occurrences. The aforementioned example
> could be rewritten as:
> 
> ; CHECK-2: movmsk
> ; CHECK-NOT: movmsk
> 
> The attached patches have 3 parts:
> * 0001-Refactor-string-checking.patch is a code refactoring of the
> current check string.
> * 0002-Add-CHECK-N-support.patch adds the support of CHECK-<N>. Only one
> regression in LLVM is required modifying as it have two check-prefixes,
> 'X86' and 'X86-64'. With the new notation, the check string prefixed
> with the later will be interpreted as 64 occurrences of 'X86' when
> checking the former. It's simply changed by replacing 'X86-64' with
> 'X64'. Document and test cases for 'CHECK-<N>' are added as well.
> * 0001-Avoid-conflicting-with-CHECK-N-in-regression-tests.patch revises
> clang regression tests to avoid conflicts with 'CHECK-<N>'.
> 
> Ofc, a common wise to revise 'check-prefix' may need to avoid conflicts
> found so far or we revise 'CHECK-<N>' for the same purpose.
> 
> Comments?
> 
> Yours
> - Michael
> 
> --
> [1] http://llvm.org/docs/TestingGuide.html
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Avoid-conflicting-with-CHECK-N-in-regression-tests.patch
Type: text/x-patch
Size: 20347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130430/d10acf90/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-CHECK-N-support.patch
Type: text/x-patch
Size: 8129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130430/d10acf90/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Refactor-string-checking.patch
Type: text/x-patch
Size: 7776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130430/d10acf90/attachment-0002.bin>


More information about the llvm-commits mailing list