Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / pragma-ms-function.c
bloba95d22ce1d81ea80df84538cf7575913e8fe3fef
1 // RUN: %clang_cc1 -emit-llvm -fms-extensions -o - %s | FileCheck %s
3 typedef typeof(sizeof(0)) size_t;
5 void bar(char *s);
6 void *memset(void *s, int c, size_t n);
7 void *memcpy(void *d, const void *s, size_t n);
9 // CHECK: define{{.*}} void @foo1({{.*}}) #[[NO_NOBUILTIN:[0-9]+]]
10 void foo1(char *s, char *d, size_t n) {
11 bar(s);
12 memset(s, 0, n);
13 memcpy(d, s, n);
16 #pragma function(strlen, memset)
18 // CHECK: define{{.*}} void @foo2({{.*}}) #[[NOBUILTIN_MEMSET:[0-9]+]]
19 void foo2(char *s, char *d, size_t n) {
20 bar(s);
21 memset(s, 1, n);
22 memcpy(d, s, n);
25 #pragma function(memcpy)
27 // CHECK: define{{.*}} void @foo3({{.*}}) #[[NOBUILTIN_MEMSET_MEMCPY:[0-9]+]]
28 void foo3(char *s, char *d, size_t n) {
29 bar(s);
30 memset(s, 2, n);
31 memcpy(d, s, n);
34 // CHECK-NOT: attributes #[[NO_NOBUILTIN]] = {{{.*}}"no-builtin-memset"{{.*}}}
35 // CHECK-NOT: attributes #[[NO_NOBUILTIN]] = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}
36 // CHECK: attributes #[[NOBUILTIN_MEMSET]] = {{{.*}}"no-builtin-memset"{{.*}}}
37 // CHECK-NOT: attributes #[[NOBUILTIN_MEMSET]] = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}
38 // CHECK: attributes #[[NOBUILTIN_MEMSET_MEMCPY]] = {{{.*}}"no-builtin-memcpy"{{.*}}"no-builtin-memset"{{.*}}}