1 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | FileCheck %s
2 // RUN: %clang -O1 %s -S -c -emit-llvm -o - | opt -ipconstprop -S | FileCheck --check-prefix=IPCP %s
3 
4 // This is a linux only test for now due to the include.
5 // UNSUPPORTED: !linux
6 
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}
10 
11 #include <pthread.h>
12 
13 const int GlobalVar = 0;
14 
15 static void *callee0(void *payload) {
16 // IPCP:      define internal i8* @callee0
17 // IPCP:        ret i8* null
18   return payload;
19 }
20 
21 static void *callee1(void *payload) {
22 // IPCP:      define internal i8* @callee1
23 // IPCP:        ret i8* bitcast (i32* @GlobalVar to i8*)
24   return payload;
25 }
26 
27 void foo() {
28   pthread_t MyFirstThread;
29   pthread_create(&MyFirstThread, NULL, callee0, NULL);
30 
31   pthread_t MySecondThread;
32   pthread_create(&MySecondThread, NULL, callee1, (void *)&GlobalVar);
33 }
34