r281785 - CodeGen: Add more checks to nobuiltin.c test, add a negative test.

Mikael Holmén via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 07:12:01 PDT 2016


Hi,

On 09/17/2016 12:05 AM, Peter Collingbourne via cfe-commits wrote:
> Author: pcc
> Date: Fri Sep 16 17:05:53 2016
> New Revision: 281785
>
> URL: http://llvm.org/viewvc/llvm-project?rev=281785&view=rev
> Log:
> CodeGen: Add more checks to nobuiltin.c test, add a negative test.
>
> Modified:
>     cfe/trunk/test/CodeGen/nobuiltin.c
>
> Modified: cfe/trunk/test/CodeGen/nobuiltin.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nobuiltin.c?rev=281785&r1=281784&r2=281785&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/nobuiltin.c (original)
> +++ cfe/trunk/test/CodeGen/nobuiltin.c Fri Sep 16 17:05:53 2016
> @@ -1,17 +1,19 @@
> -// RUN: %clang_cc1 -fno-builtin -O1 -S -o - %s | FileCheck %s
> -// RUN: %clang_cc1 -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=MEMSET %s
> +// RUN: %clang_cc1 -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s
> +// RUN: %clang_cc1 -fno-builtin -O1 -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s
> +// RUN: %clang_cc1 -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s
>
>  void PR13497() {
>    char content[2];
>    // make sure we don't optimize this call to strcpy()
> -  // CHECK: __strcpy_chk
> +  // STRCPY-NOT: __strcpy_chk
> +  // NOSTRCPY: __strcpy_chk
>    __builtin___strcpy_chk(content, "", 1);
>  }
>
>  void PR4941(char *s) {
>    // Make sure we don't optimize this loop to a memset().
> -  // MEMSET-LABEL: PR4941:
> -  // MEMSET-NOT: memset
> +  // NOMEMSET-NOT: memset
> +  // MEMSET: memset

I suppose this is a general problem for CHECK-NOT:s, but I happened to 
have a repo with "memset" in the name, and then this NOMEMSET-NOT failed 
because it found "memset" in the file path.

So maybe change so it looks for "memset@" or something that might at 
least be less likely to appear in the path? Ideally the test should ofc 
be changed so it only looks for "memset" inside the PR4941 function but 
I'm too noobish on FileCheck to know if that's possible,

Regards,
Mikael

>    for (unsigned i = 0; i < 8192; ++i)
>      s[i] = 0;
>  }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>


More information about the cfe-commits mailing list