llvm-project/clang/test/CodeGen/nobuiltin.c

26 lines
1.3 KiB
C
Raw Normal View History

2016-09-17 06:56:12 +08:00
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin -O1 -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s
2012-08-02 01:02:30 +08:00
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O1 -fexperimental-new-pass-manager -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin -O1 -fexperimental-new-pass-manager -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin-memset -O1 -fexperimental-new-pass-manager -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s
void PR13497() {
2012-08-02 01:02:30 +08:00
char content[2];
// make sure we don't optimize this call to strcpy()
// STRCPY-NOT: __strcpy_chk
// NOSTRCPY: __strcpy_chk
2012-08-02 01:02:30 +08:00
__builtin___strcpy_chk(content, "", 1);
}
void PR4941(char *s) {
// Make sure we don't optimize this loop to a memset().
// NOMEMSET-NOT: memset
// MEMSET: memset
for (unsigned i = 0; i < 8192; ++i)
s[i] = 0;
}