Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / callback_pthread_create.c
blob80457cb3ade3bbf5f939f2f0dcde7a213eb7fb9e
1 // FIXME: pthread_create() definition in Builtins.def doesn't match the real one, so it doesn't get recognized as a builtin and attributes aren't added.
2 // RUN: false
3 // XFAIL: *
5 // RUN: %clang_cc1 %s -S -emit-llvm -o - -disable-llvm-optzns | FileCheck %s
7 // CHECK: declare !callback ![[cid:[0-9]+]] {{.*}}i32 @pthread_create
8 // CHECK: ![[cid]] = !{![[cidb:[0-9]+]]}
9 // CHECK: ![[cidb]] = !{i64 2, i64 3, i1 false}
11 // Taken from test/Analysis/retain-release.m
12 //{
13 struct _opaque_pthread_t {};
14 struct _opaque_pthread_attr_t {};
15 typedef struct _opaque_pthread_t *__darwin_pthread_t;
16 typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
17 typedef __darwin_pthread_t pthread_t;
18 typedef __darwin_pthread_attr_t pthread_attr_t;
20 int pthread_create(pthread_t *, const pthread_attr_t *,
21 void *(*)(void *), void *);
22 //}
24 const int GlobalVar = 0;
26 static void *callee0(void *payload) {
27 return payload;
30 static void *callee1(void *payload) {
31 return payload;
34 void foo() {
35 pthread_t MyFirstThread;
36 pthread_create(&MyFirstThread, 0, callee0, 0);
38 pthread_t MySecondThread;
39 pthread_create(&MySecondThread, 0, callee1, (void *)&GlobalVar);