22 lines · c
1// REQUIRES: x86-registered-target2 3// RUN: %clang_cc1 -triple x86_64-linux-gnu -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s4// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin -O1 -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s5// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s6 7void PR13497(void) {8 char content[2];9 // make sure we don't optimize this call to strcpy()10 // STRCPY-NOT: __strcpy_chk11 // NOSTRCPY: __strcpy_chk12 __builtin___strcpy_chk(content, "", 1);13}14 15void PR4941(char *s) {16 // Make sure we don't optimize this loop to a memset().17 // NOMEMSET-NOT: memset18 // MEMSET: memset19 for (unsigned i = 0; i < 8192; ++i)20 s[i] = 0;21}22