xref: /minix3/sys/external/bsd/compiler_rt/dist/test/profile/instrprof-dlopen.test (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel SambucRUN: mkdir -p %t.d
2*0a6a1f1dSLionel SambucRUN: %clang_profgen -o %t.d/func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c
3*0a6a1f1dSLionel SambucRUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c
4*0a6a1f1dSLionel SambucRUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/Inputs/instrprof-dlopen-main.c -ldl
5*0a6a1f1dSLionel SambucRUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/Inputs/instrprof-dlopen-main.c -ldl
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel SambucRUN: %clang -c -o %t.d/main.o %S/Inputs/instrprof-dlopen-main.c
8*0a6a1f1dSLionel SambucRUN: %clang_profgen -o %t-static %S/Inputs/instrprof-dlopen-func.c %S/Inputs/instrprof-dlopen-func2.c %t.d/main.o
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel SambucRUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
11*0a6a1f1dSLionel SambucRUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
12*0a6a1f1dSLionel SambucRUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel SambucRUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
15*0a6a1f1dSLionel SambucRUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
16*0a6a1f1dSLionel SambucRUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
17*0a6a1f1dSLionel Sambuc
18*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
19*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
20*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
21*0a6a1f1dSLionel SambucRUN: diff %t-func.static.ll %t-func.local.ll
22*0a6a1f1dSLionel SambucRUN: diff %t-func.static.ll %t-func.global.ll
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
25*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
26*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
27*0a6a1f1dSLionel SambucRUN: diff %t-func2.static.ll %t-func2.local.ll
28*0a6a1f1dSLionel SambucRUN: diff %t-func2.static.ll %t-func2.global.ll
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
31*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
32*0a6a1f1dSLionel SambucRUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
33*0a6a1f1dSLionel SambucRUN: diff %t-main.static.ll %t-main.local.ll
34*0a6a1f1dSLionel SambucRUN: diff %t-main.static.ll %t-main.global.ll
35