aboutsummaryrefslogtreecommitdiff
path: root/test/profile
diff options
context:
space:
mode:
Diffstat (limited to 'test/profile')
-rw-r--r--test/profile/Inputs/instrprof-dlopen-dlclose-main.c86
-rw-r--r--test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov91
-rw-r--r--test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov91
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func.c2
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func.c.gcov6
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func2.c2
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func2.c.gcov6
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func3.c1
-rw-r--r--test/profile/Inputs/instrprof-dlopen-func3.c.gcov6
-rw-r--r--test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c13
-rw-r--r--test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov18
-rw-r--r--test/profile/Inputs/instrprof-gcov-exceptions.cpp11
-rw-r--r--test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov16
-rw-r--r--test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c20
-rw-r--r--test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov34
-rw-r--r--test/profile/Inputs/instrprof-shared-lib.c.gcov14
-rw-r--r--test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov14
-rw-r--r--test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov14
-rw-r--r--test/profile/Inputs/instrprof-shared-main-gcov-flush.c36
-rw-r--r--test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov41
-rw-r--r--test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov41
-rw-r--r--test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov41
-rw-r--r--test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov41
-rw-r--r--test/profile/Inputs/instrprof-shared-main.c.gcov18
-rw-r--r--test/profile/Linux/counter_promo_nest.c3
-rw-r--r--test/profile/Linux/instrprof-value-merge.c79
-rw-r--r--test/profile/instrprof-darwin-dead-strip.c16
-rw-r--r--test/profile/instrprof-darwin-exports.c11
-rw-r--r--test/profile/instrprof-dlopen-dlclose-gcov.test30
-rw-r--r--test/profile/instrprof-gcov-__gcov_flush-terminate.test12
-rw-r--r--test/profile/instrprof-gcov-exceptions.test21
-rw-r--r--test/profile/instrprof-gcov-multiple-bbs-single-line.test13
-rw-r--r--test/profile/instrprof-gcov-two-objects.test18
-rw-r--r--test/profile/instrprof-get-filename.c39
-rw-r--r--test/profile/instrprof-path.c2
-rw-r--r--test/profile/instrprof-reset-counters.c2
-rw-r--r--test/profile/instrprof-shared-gcov-flush.test52
-rw-r--r--test/profile/instrprof-visibility.cpp4
38 files changed, 957 insertions, 8 deletions
diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c
new file mode 100644
index 000000000000..3f4a4f6cc6a6
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c
@@ -0,0 +1,86 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]) {
+ dlerror();
+ void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);
+ if (f1_handle == NULL) {
+ fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func");
+ if (func == NULL) {
+ fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ dlerror();
+ void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);
+ if (f2_handle == NULL) {
+ fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2");
+ if (func2 == NULL) {
+ fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+ func2();
+
+#ifdef USE_LIB3
+ void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);
+ if (f3_handle == NULL) {
+ fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3");
+ if (func3 == NULL) {
+ fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+ func3();
+#endif
+
+ dlerror();
+ void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush");
+ if (gcov_flush1 == NULL) {
+ fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ dlerror();
+ void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush");
+ if (gcov_flush2 == NULL) {
+ fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ if (gcov_flush1 == gcov_flush2) {
+ fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n");
+ return EXIT_FAILURE;
+ }
+
+ dlerror();
+ if (dlclose(f2_handle) != 0) {
+ fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror());
+ return EXIT_FAILURE;
+ }
+
+ func();
+
+ int g1 = 0;
+ int g2 = 0;
+ int n = 10;
+
+ if (n % 5 == 0)
+ g1++;
+ else
+ g2++;
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov
new file mode 100644
index 000000000000..acb2076fd763
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-dlclose-main.c.gcov
@@ -0,0 +1,91 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c
+// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-dlclose-main.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-dlopen-dlclose-main.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:#include <dlfcn.h>
+// CHECK-NEXT: -: 2:#include <stdio.h>
+// CHECK-NEXT: -: 3:#include <stdlib.h>
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: -: 5:int main(int argc, char *argv[]) {
+// CHECK-NEXT: 1: 6: dlerror();
+// CHECK-NEXT: 1: 7: void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: 1: 8: if (f1_handle == NULL) {
+// CHECK-NEXT: #####: 9: fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 10: return EXIT_FAILURE;
+// CHECK-NEXT: -: 11: }
+// CHECK-NEXT: -: 12:
+// CHECK-NEXT: 1: 13: void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func");
+// CHECK-NEXT: 1: 14: if (func == NULL) {
+// CHECK-NEXT: #####: 15: fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror());
+// CHECK-NEXT: #####: 16: return EXIT_FAILURE;
+// CHECK-NEXT: -: 17: }
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: dlerror();
+// CHECK-NEXT: 1: 20: void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: 1: 21: if (f2_handle == NULL) {
+// CHECK-NEXT: #####: 22: fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 23: return EXIT_FAILURE;
+// CHECK-NEXT: -: 24: }
+// CHECK-NEXT: -: 25:
+// CHECK-NEXT: 1: 26: void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2");
+// CHECK-NEXT: 1: 27: if (func2 == NULL) {
+// CHECK-NEXT: #####: 28: fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror());
+// CHECK-NEXT: #####: 29: return EXIT_FAILURE;
+// CHECK-NEXT: -: 30: }
+// CHECK-NEXT: 1: 31: func2();
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: -: 33:#ifdef USE_LIB3
+// CHECK-NEXT: -: 34: void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: -: 35: if (f3_handle == NULL) {
+// CHECK-NEXT: -: 36: fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror());
+// CHECK-NEXT: -: 37: return EXIT_FAILURE;
+// CHECK-NEXT: -: 38: }
+// CHECK-NEXT: -: 39:
+// CHECK-NEXT: -: 40: void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3");
+// CHECK-NEXT: -: 41: if (func3 == NULL) {
+// CHECK-NEXT: -: 42: fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror());
+// CHECK-NEXT: -: 43: return EXIT_FAILURE;
+// CHECK-NEXT: -: 44: }
+// CHECK-NEXT: -: 45: func3();
+// CHECK-NEXT: -: 46:#endif
+// CHECK-NEXT: -: 47:
+// CHECK-NEXT: 1: 48: dlerror();
+// CHECK-NEXT: 1: 49: void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush");
+// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL) {
+// CHECK-NEXT: #####: 51: fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 52: return EXIT_FAILURE;
+// CHECK-NEXT: -: 53: }
+// CHECK-NEXT: -: 54:
+// CHECK-NEXT: 1: 55: dlerror();
+// CHECK-NEXT: 1: 56: void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush");
+// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL) {
+// CHECK-NEXT: #####: 58: fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 59: return EXIT_FAILURE;
+// CHECK-NEXT: -: 60: }
+// CHECK-NEXT: -: 61:
+// CHECK-NEXT: 1: 62: if (gcov_flush1 == gcov_flush2) {
+// CHECK-NEXT: #####: 63: fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n");
+// CHECK-NEXT: #####: 64: return EXIT_FAILURE;
+// CHECK-NEXT: -: 65: }
+// CHECK-NEXT: -: 66:
+// CHECK-NEXT: 1: 67: dlerror();
+// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) != 0) {
+// CHECK-NEXT: #####: 69: fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 70: return EXIT_FAILURE;
+// CHECK-NEXT: -: 71: }
+// CHECK-NEXT: -: 72:
+// CHECK-NEXT: 1: 73: func();
+// CHECK-NEXT: -: 74:
+// CHECK-NEXT: 1: 75: int g1 = 0;
+// CHECK-NEXT: 1: 76: int g2 = 0;
+// CHECK-NEXT: 1: 77: int n = 10;
+// CHECK-NEXT: -: 78:
+// CHECK-NEXT: 1: 79: if (n % 5 == 0)
+// CHECK-NEXT: 1: 80: g1++;
+// CHECK-NEXT: -: 81: else
+// CHECK-NEXT: #####: 82: g2++;
+// CHECK-NEXT: -: 83:
+// CHECK-NEXT: 1: 84: return EXIT_SUCCESS;
+// CHECK-NEXT: 1: 85:}
+// CHECK-NEXT: -: 86:
diff --git a/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov b/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov
new file mode 100644
index 000000000000..97eef4c3b905
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov
@@ -0,0 +1,91 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-dlclose-main.c
+// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-dlclose-main.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-dlopen-dlclose-main.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:#include <dlfcn.h>
+// CHECK-NEXT: -: 2:#include <stdio.h>
+// CHECK-NEXT: -: 3:#include <stdlib.h>
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: -: 5:int main(int argc, char *argv[]) {
+// CHECK-NEXT: 1: 6: dlerror();
+// CHECK-NEXT: 1: 7: void *f1_handle = dlopen("func.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: 1: 8: if (f1_handle == NULL) {
+// CHECK-NEXT: #####: 9: fprintf(stderr, "unable to open 'func.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 10: return EXIT_FAILURE;
+// CHECK-NEXT: -: 11: }
+// CHECK-NEXT: -: 12:
+// CHECK-NEXT: 1: 13: void (*func)(void) = (void (*)(void))dlsym(f1_handle, "func");
+// CHECK-NEXT: 1: 14: if (func == NULL) {
+// CHECK-NEXT: #####: 15: fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror());
+// CHECK-NEXT: #####: 16: return EXIT_FAILURE;
+// CHECK-NEXT: -: 17: }
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: dlerror();
+// CHECK-NEXT: 1: 20: void *f2_handle = dlopen("func2.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: 1: 21: if (f2_handle == NULL) {
+// CHECK-NEXT: #####: 22: fprintf(stderr, "unable to open 'func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 23: return EXIT_FAILURE;
+// CHECK-NEXT: -: 24: }
+// CHECK-NEXT: -: 25:
+// CHECK-NEXT: 1: 26: void (*func2)(void) = (void (*)(void))dlsym(f2_handle, "func2");
+// CHECK-NEXT: 1: 27: if (func2 == NULL) {
+// CHECK-NEXT: #####: 28: fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror());
+// CHECK-NEXT: #####: 29: return EXIT_FAILURE;
+// CHECK-NEXT: -: 30: }
+// CHECK-NEXT: 1: 31: func2();
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: -: 33:#ifdef USE_LIB3
+// CHECK-NEXT: 1: 34: void *f3_handle = dlopen("func3.shared", RTLD_LAZY | RTLD_GLOBAL);
+// CHECK-NEXT: 1: 35: if (f3_handle == NULL) {
+// CHECK-NEXT: #####: 36: fprintf(stderr, "unable to open 'func3.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 37: return EXIT_FAILURE;
+// CHECK-NEXT: -: 38: }
+// CHECK-NEXT: -: 39:
+// CHECK-NEXT: 1: 40: void (*func3)(void) = (void (*)(void))dlsym(f3_handle, "func3");
+// CHECK-NEXT: 1: 41: if (func3 == NULL) {
+// CHECK-NEXT: #####: 42: fprintf(stderr, "unable to lookup symbol 'func3': %s\n", dlerror());
+// CHECK-NEXT: #####: 43: return EXIT_FAILURE;
+// CHECK-NEXT: -: 44: }
+// CHECK-NEXT: 1: 45: func3();
+// CHECK-NEXT: -: 46:#endif
+// CHECK-NEXT: -: 47:
+// CHECK-NEXT: 1: 48: dlerror();
+// CHECK-NEXT: 1: 49: void (*gcov_flush1)() = (void (*)())dlsym(f1_handle, "__gcov_flush");
+// CHECK-NEXT: 1: 50: if (gcov_flush1 == NULL) {
+// CHECK-NEXT: #####: 51: fprintf(stderr, "unable to find __gcov_flush in func.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 52: return EXIT_FAILURE;
+// CHECK-NEXT: -: 53: }
+// CHECK-NEXT: -: 54:
+// CHECK-NEXT: 1: 55: dlerror();
+// CHECK-NEXT: 1: 56: void (*gcov_flush2)() = (void (*)())dlsym(f2_handle, "__gcov_flush");
+// CHECK-NEXT: 1: 57: if (gcov_flush2 == NULL) {
+// CHECK-NEXT: #####: 58: fprintf(stderr, "unable to find __gcov_flush in func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 59: return EXIT_FAILURE;
+// CHECK-NEXT: -: 60: }
+// CHECK-NEXT: -: 61:
+// CHECK-NEXT: 1: 62: if (gcov_flush1 == gcov_flush2) {
+// CHECK-NEXT: #####: 63: fprintf(stderr, "Same __gcov_flush found in func.shared and func2.shared\n");
+// CHECK-NEXT: #####: 64: return EXIT_FAILURE;
+// CHECK-NEXT: -: 65: }
+// CHECK-NEXT: -: 66:
+// CHECK-NEXT: 1: 67: dlerror();
+// CHECK-NEXT: 1: 68: if (dlclose(f2_handle) != 0) {
+// CHECK-NEXT: #####: 69: fprintf(stderr, "unable to close 'func2.shared': %s\n", dlerror());
+// CHECK-NEXT: #####: 70: return EXIT_FAILURE;
+// CHECK-NEXT: -: 71: }
+// CHECK-NEXT: -: 72:
+// CHECK-NEXT: 1: 73: func();
+// CHECK-NEXT: -: 74:
+// CHECK-NEXT: 1: 75: int g1 = 0;
+// CHECK-NEXT: 1: 76: int g2 = 0;
+// CHECK-NEXT: 1: 77: int n = 10;
+// CHECK-NEXT: -: 78:
+// CHECK-NEXT: 1: 79: if (n % 5 == 0)
+// CHECK-NEXT: 1: 80: g1++;
+// CHECK-NEXT: -: 81: else
+// CHECK-NEXT: #####: 82: g2++;
+// CHECK-NEXT: -: 83:
+// CHECK-NEXT: 1: 84: return EXIT_SUCCESS;
+// CHECK-NEXT: 1: 85:}
+// CHECK-NEXT: -: 86:
diff --git a/test/profile/Inputs/instrprof-dlopen-func.c b/test/profile/Inputs/instrprof-dlopen-func.c
index f2de3883535a..9a56e4976570 100644
--- a/test/profile/Inputs/instrprof-dlopen-func.c
+++ b/test/profile/Inputs/instrprof-dlopen-func.c
@@ -1 +1 @@
-void func(int K) { if (K) {} }
+void func(int K) {}
diff --git a/test/profile/Inputs/instrprof-dlopen-func.c.gcov b/test/profile/Inputs/instrprof-dlopen-func.c.gcov
new file mode 100644
index 000000000000..3af4ec94a1b0
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-func.c.gcov
@@ -0,0 +1,6 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func.c
+// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: 1: 1:void func(int K) {}
diff --git a/test/profile/Inputs/instrprof-dlopen-func2.c b/test/profile/Inputs/instrprof-dlopen-func2.c
index d4d93dc0b256..ab62f14952c7 100644
--- a/test/profile/Inputs/instrprof-dlopen-func2.c
+++ b/test/profile/Inputs/instrprof-dlopen-func2.c
@@ -1 +1 @@
-void func2(int K) { if (K) {} }
+void func2(int K) {}
diff --git a/test/profile/Inputs/instrprof-dlopen-func2.c.gcov b/test/profile/Inputs/instrprof-dlopen-func2.c.gcov
new file mode 100644
index 000000000000..7101f74b938d
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-func2.c.gcov
@@ -0,0 +1,6 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c
+// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: 1: 1:void func2(int K) {}
diff --git a/test/profile/Inputs/instrprof-dlopen-func3.c b/test/profile/Inputs/instrprof-dlopen-func3.c
new file mode 100644
index 000000000000..ec0dddb45274
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-func3.c
@@ -0,0 +1 @@
+void func3(int K) {}
diff --git a/test/profile/Inputs/instrprof-dlopen-func3.c.gcov b/test/profile/Inputs/instrprof-dlopen-func3.c.gcov
new file mode 100644
index 000000000000..7101f74b938d
--- /dev/null
+++ b/test/profile/Inputs/instrprof-dlopen-func3.c.gcov
@@ -0,0 +1,6 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-dlopen-func2.c
+// CHECK-NEXT: -: 0:Graph:instrprof-dlopen-func2.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-dlopen-func2.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: 1: 1:void func2(int K) {}
diff --git a/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c b/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c
new file mode 100644
index 000000000000..7b24d69c75fc
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c
@@ -0,0 +1,13 @@
+int main(void) {
+ int i = 22;
+
+ __gcov_flush();
+
+ i = 42;
+
+ asm("int $3");
+
+ i = 84;
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov b/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
new file mode 100644
index 000000000000..69e229a3127e
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
@@ -0,0 +1,18 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-__gcov_flush-terminate.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-__gcov_flush-terminate.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-__gcov_flush-terminate.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int main(void) {
+// CHECK-NEXT: 1: 2: int i = 22;
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: 1: 4: __gcov_flush();
+// CHECK-NEXT: -: 5:
+// CHECK-NEXT: #####: 6: i = 42;
+// CHECK-NEXT: -: 7:
+// CHECK-NEXT: #####: 8: asm("int $3");
+// CHECK-NEXT: -: 9:
+// CHECK-NEXT: #####: 10: i = 84;
+// CHECK-NEXT: -: 11:
+// CHECK-NEXT: #####: 12: return 0;
+// CHECK-NEXT: -: 13:}
diff --git a/test/profile/Inputs/instrprof-gcov-exceptions.cpp b/test/profile/Inputs/instrprof-gcov-exceptions.cpp
new file mode 100644
index 000000000000..327966551d09
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-exceptions.cpp
@@ -0,0 +1,11 @@
+#include <string>
+
+void asd(std::string i) {
+}
+
+int main(void)
+{
+ asd("22");
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov b/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov
new file mode 100644
index 000000000000..7caf50806020
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-exceptions.cpp.gcov
@@ -0,0 +1,16 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-exceptions.cpp
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-exceptions.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-exceptions.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:#include <string>
+// CHECK-NEXT: -: 2:
+// CHECK-NEXT: -: 3:void asd(std::string i) {
+// CHECK-NEXT: 2: 4:}
+// CHECK-NEXT: -: 5:
+// CHECK-NEXT: -: 6:int main(void)
+// CHECK-NEXT: -: 7:{
+// CHECK-NEXT: 1: 8: asd("22");
+// CHECK-NEXT: -: 9:
+// CHECK-NEXT: 1: 10: return 0;
+// CHECK-NEXT: -: 11:}
diff --git a/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c b/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c
new file mode 100644
index 000000000000..a2e187b5cb61
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c
@@ -0,0 +1,20 @@
+int main(void)
+{
+ int var;
+
+ int a = 1;
+ if (a) {
+ var++;
+ }
+
+ if (a) {}
+
+ int b = 0;
+ if (b) {
+ var++;
+ }
+
+ if (b) {}
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov b/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov
new file mode 100644
index 000000000000..92532af30674
--- /dev/null
+++ b/test/profile/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov
@@ -0,0 +1,34 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-gcov-multiple-bbs-single-line.c
+// CHECK-NEXT: -: 0:Graph:instrprof-gcov-multiple-bbs-single-line.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-gcov-multiple-bbs-single-line.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT:function main called 1 returned 100% blocks executed 80%
+// CHECK-NEXT: -: 1:int main(void)
+// CHECK-NEXT: -: 2:{
+// CHECK-NEXT: -: 3: int var;
+// CHECK-NEXT: -: 4:
+// CHECK-NEXT: 1: 5: int a = 1;
+// CHECK-NEXT: 1: 6: if (a) {
+// CHECK-NEXT:branch 0 taken 1
+// CHECK-NEXT:branch 1 taken 0
+// CHECK-NEXT: 1: 7: var++;
+// CHECK-NEXT: 1: 8: }
+// CHECK-NEXT: -: 9:
+// CHECK-NEXT: 1: 10: if (a) {}
+// CHECK-NEXT:branch 0 taken 1
+// CHECK-NEXT:branch 1 taken 0
+// CHECK-NEXT: -: 11:
+// CHECK-NEXT: 1: 12: int b = 0;
+// CHECK-NEXT: 1: 13: if (b) {
+// CHECK-NEXT:branch 0 taken 0
+// CHECK-NEXT:branch 1 taken 1
+// CHECK-NEXT: #####: 14: var++;
+// CHECK-NEXT: #####: 15: }
+// CHECK-NEXT: -: 16:
+// CHECK-NEXT: 1: 17: if (b) {}
+// CHECK-NEXT:branch 0 taken 0
+// CHECK-NEXT:branch 1 taken 1
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: return 0;
+// CHECK-NEXT: -: 20:}
diff --git a/test/profile/Inputs/instrprof-shared-lib.c.gcov b/test/profile/Inputs/instrprof-shared-lib.c.gcov
new file mode 100644
index 000000000000..fbc43d5f7d50
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-lib.c.gcov
@@ -0,0 +1,14 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int g1 = 0;
+// CHECK-NEXT: -: 2:int g2 = 1;
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:void foo(int n) {
+// CHECK-NEXT: 1: 5: if (n % 5 == 0)
+// CHECK-NEXT: #####: 6: g1++;
+// CHECK-NEXT: -: 7: else
+// CHECK-NEXT: 1: 8: g2++;
+// CHECK-NEXT: 1: 9:}
diff --git a/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov b/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov
new file mode 100644
index 000000000000..779c885d862d
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-lib_called-twice.c.gcov
@@ -0,0 +1,14 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int g1 = 0;
+// CHECK-NEXT: -: 2:int g2 = 1;
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:void foo(int n) {
+// CHECK-NEXT: 2: 5: if (n % 5 == 0)
+// CHECK-NEXT: #####: 6: g1++;
+// CHECK-NEXT: -: 7: else
+// CHECK-NEXT: 2: 8: g2++;
+// CHECK-NEXT: 2: 9:}
diff --git a/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov b/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov
new file mode 100644
index 000000000000..76503d91426e
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-lib_in-loop.c.gcov
@@ -0,0 +1,14 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-lib.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-lib.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-lib.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:int g1 = 0;
+// CHECK-NEXT: -: 2:int g2 = 1;
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:void foo(int n) {
+// CHECK-NEXT: 1000000: 5: if (n % 5 == 0)
+// CHECK-NEXT: 360000: 6: g1++;
+// CHECK-NEXT: -: 7: else
+// CHECK-NEXT: 640000: 8: g2++;
+// CHECK-NEXT: 1000000: 9:}
diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush.c b/test/profile/Inputs/instrprof-shared-main-gcov-flush.c
new file mode 100644
index 000000000000..9f41b7e6362a
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main-gcov-flush.c
@@ -0,0 +1,36 @@
+extern void foo(int n);
+extern void __gcov_flush(void);
+
+int bar1 = 0;
+int bar2 = 1;
+
+void bar(int n) {
+ if (n % 5 == 0)
+ bar1++;
+ else
+ bar2++;
+}
+
+int main(int argc, char *argv[]) {
+#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH
+ foo(1);
+#endif
+
+ bar(5);
+
+ __gcov_flush();
+
+ bar(5);
+
+#ifdef SHARED_CALL_AFTER_GCOV_FLUSH
+ foo(1);
+#endif
+
+#ifdef EXIT_ABRUPTLY
+ _exit(0);
+#endif
+
+ bar(5);
+
+ return 0;
+}
diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
new file mode 100644
index 000000000000..b2dfe2acde67
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
@@ -0,0 +1,41 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:extern void foo(int n);
+// CHECK-NEXT: -: 2:extern void __gcov_flush(void);
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:int bar1 = 0;
+// CHECK-NEXT: -: 5:int bar2 = 1;
+// CHECK-NEXT: -: 6:
+// CHECK-NEXT: -: 7:void bar(int n) {
+// CHECK-NEXT: 1: 8: if (n % 5 == 0)
+// CHECK-NEXT: 1: 9: bar1++;
+// CHECK-NEXT: -: 10: else
+// CHECK-NEXT: #####: 11: bar2++;
+// CHECK-NEXT: 1: 12:}
+// CHECK-NEXT: -: 13:
+// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) {
+// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH
+// CHECK-NEXT: 1: 16: foo(1);
+// CHECK-NEXT: -: 17:#endif
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: bar(5);
+// CHECK-NEXT: -: 20:
+// CHECK-NEXT: 1: 21: __gcov_flush();
+// CHECK-NEXT: -: 22:
+// CHECK-NEXT: 1: 23: bar(5);
+// CHECK-NEXT: -: 24:
+// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH
+// CHECK-NEXT: 1: 26: foo(1);
+// CHECK-NEXT: -: 27:#endif
+// CHECK-NEXT: -: 28:
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY
+// CHECK-NEXT: 1: 30: _exit(0);
+// CHECK-NEXT: -: 31:#endif
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: -: 33: bar(5);
+// CHECK-NEXT: -: 34:
+// CHECK-NEXT: -: 35: return 0;
+// CHECK-NEXT: #####: 36:}
diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
new file mode 100644
index 000000000000..f70e34e52894
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
@@ -0,0 +1,41 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:extern void foo(int n);
+// CHECK-NEXT: -: 2:extern void __gcov_flush(void);
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:int bar1 = 0;
+// CHECK-NEXT: -: 5:int bar2 = 1;
+// CHECK-NEXT: -: 6:
+// CHECK-NEXT: -: 7:void bar(int n) {
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)
+// CHECK-NEXT: 3: 9: bar1++;
+// CHECK-NEXT: -: 10: else
+// CHECK-NEXT: #####: 11: bar2++;
+// CHECK-NEXT: 3: 12:}
+// CHECK-NEXT: -: 13:
+// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) {
+// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH
+// CHECK-NEXT: -: 16: foo(1);
+// CHECK-NEXT: -: 17:#endif
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: bar(5);
+// CHECK-NEXT: -: 20:
+// CHECK-NEXT: 1: 21: __gcov_flush();
+// CHECK-NEXT: -: 22:
+// CHECK-NEXT: 1: 23: bar(5);
+// CHECK-NEXT: -: 24:
+// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH
+// CHECK-NEXT: 1: 26: foo(1);
+// CHECK-NEXT: -: 27:#endif
+// CHECK-NEXT: -: 28:
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY
+// CHECK-NEXT: -: 30: _exit(0);
+// CHECK-NEXT: -: 31:#endif
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: 1: 33: bar(5);
+// CHECK-NEXT: -: 34:
+// CHECK-NEXT: 1: 35: return 0;
+// CHECK-NEXT: -: 36:}
diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
new file mode 100644
index 000000000000..b9ecff698722
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
@@ -0,0 +1,41 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:extern void foo(int n);
+// CHECK-NEXT: -: 2:extern void __gcov_flush(void);
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:int bar1 = 0;
+// CHECK-NEXT: -: 5:int bar2 = 1;
+// CHECK-NEXT: -: 6:
+// CHECK-NEXT: -: 7:void bar(int n) {
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)
+// CHECK-NEXT: 3: 9: bar1++;
+// CHECK-NEXT: -: 10: else
+// CHECK-NEXT: #####: 11: bar2++;
+// CHECK-NEXT: 3: 12:}
+// CHECK-NEXT: -: 13:
+// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) {
+// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH
+// CHECK-NEXT: 1: 16: foo(1);
+// CHECK-NEXT: -: 17:#endif
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: bar(5);
+// CHECK-NEXT: -: 20:
+// CHECK-NEXT: 1: 21: __gcov_flush();
+// CHECK-NEXT: -: 22:
+// CHECK-NEXT: 1: 23: bar(5);
+// CHECK-NEXT: -: 24:
+// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH
+// CHECK-NEXT: 1: 26: foo(1);
+// CHECK-NEXT: -: 27:#endif
+// CHECK-NEXT: -: 28:
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY
+// CHECK-NEXT: -: 30: _exit(0);
+// CHECK-NEXT: -: 31:#endif
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: 1: 33: bar(5);
+// CHECK-NEXT: -: 34:
+// CHECK-NEXT: 1: 35: return 0;
+// CHECK-NEXT: -: 36:}
diff --git a/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
new file mode 100644
index 000000000000..7c9e0afa11b2
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
@@ -0,0 +1,41 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main-gcov-flush.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-main-gcov-flush.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-main-gcov-flush.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:extern void foo(int n);
+// CHECK-NEXT: -: 2:extern void __gcov_flush(void);
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:int bar1 = 0;
+// CHECK-NEXT: -: 5:int bar2 = 1;
+// CHECK-NEXT: -: 6:
+// CHECK-NEXT: -: 7:void bar(int n) {
+// CHECK-NEXT: 3: 8: if (n % 5 == 0)
+// CHECK-NEXT: 3: 9: bar1++;
+// CHECK-NEXT: -: 10: else
+// CHECK-NEXT: #####: 11: bar2++;
+// CHECK-NEXT: 3: 12:}
+// CHECK-NEXT: -: 13:
+// CHECK-NEXT: -: 14:int main(int argc, char *argv[]) {
+// CHECK-NEXT: -: 15:#ifdef SHARED_CALL_BEFORE_GCOV_FLUSH
+// CHECK-NEXT: 1: 16: foo(1);
+// CHECK-NEXT: -: 17:#endif
+// CHECK-NEXT: -: 18:
+// CHECK-NEXT: 1: 19: bar(5);
+// CHECK-NEXT: -: 20:
+// CHECK-NEXT: 1: 21: __gcov_flush();
+// CHECK-NEXT: -: 22:
+// CHECK-NEXT: 1: 23: bar(5);
+// CHECK-NEXT: -: 24:
+// CHECK-NEXT: -: 25:#ifdef SHARED_CALL_AFTER_GCOV_FLUSH
+// CHECK-NEXT: -: 26: foo(1);
+// CHECK-NEXT: -: 27:#endif
+// CHECK-NEXT: -: 28:
+// CHECK-NEXT: -: 29:#ifdef EXIT_ABRUPTLY
+// CHECK-NEXT: -: 30: _exit(0);
+// CHECK-NEXT: -: 31:#endif
+// CHECK-NEXT: -: 32:
+// CHECK-NEXT: 1: 33: bar(5);
+// CHECK-NEXT: -: 34:
+// CHECK-NEXT: 1: 35: return 0;
+// CHECK-NEXT: -: 36:}
diff --git a/test/profile/Inputs/instrprof-shared-main.c.gcov b/test/profile/Inputs/instrprof-shared-main.c.gcov
new file mode 100644
index 000000000000..70be367507ff
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-main.c.gcov
@@ -0,0 +1,18 @@
+// CHECK: -: 0:Source:{{.*}}Inputs/instrprof-shared-main.c
+// CHECK-NEXT: -: 0:Graph:instrprof-shared-main.gcno
+// CHECK-NEXT: -: 0:Data:instrprof-shared-main.gcda
+// CHECK-NEXT: -: 0:Runs:1
+// CHECK-NEXT: -: 0:Programs:1
+// CHECK-NEXT: -: 1:extern int g1, g2;
+// CHECK-NEXT: -: 2:extern void foo(int n);
+// CHECK-NEXT: -: 3:
+// CHECK-NEXT: -: 4:int main() {
+// CHECK-NEXT: -: 5: int i, j;
+// CHECK-NEXT: 2002: 6: for (i = 0; i < 1000; i++)
+// CHECK-NEXT: 2002000: 7: for (j = 0; j < 1000; j++)
+// CHECK-NEXT: 1001000: 8: foo(i * j);
+// CHECK-NEXT: -: 9:
+// CHECK-NEXT: 1: 10: if (g2 - g1 == 280001)
+// CHECK-NEXT: 1: 11: return 0;
+// CHECK-NEXT: #####: 12: return 1;
+// CHECK-NEXT: 1: 13:}
diff --git a/test/profile/Linux/counter_promo_nest.c b/test/profile/Linux/counter_promo_nest.c
index 0792f0c76abb..ebd52dda7f48 100644
--- a/test/profile/Linux/counter_promo_nest.c
+++ b/test/profile/Linux/counter_promo_nest.c
@@ -25,6 +25,9 @@ int main()
// PROMO: load{{.*}}@__profc_main{{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_main{{.*}}
+// PROMO: load{{.*}}@__profc_main{{.*}}
+// PROMO-NEXT: add
+// PROMO-NEXT: store{{.*}}@__profc_main{{.*}}
// PROMO-NEXT: load{{.*}}@__profc_main{{.*}}
// PROMO-NEXT: add
// PROMO-NEXT: store{{.*}}@__profc_main{{.*}}
diff --git a/test/profile/Linux/instrprof-value-merge.c b/test/profile/Linux/instrprof-value-merge.c
new file mode 100644
index 000000000000..902430a4a968
--- /dev/null
+++ b/test/profile/Linux/instrprof-value-merge.c
@@ -0,0 +1,79 @@
+// RUN: %clang_pgogen -o %t -O3 %s
+// RUN: rm -rf %t.profdir
+// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
+// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
+// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
+// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
+// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t 1
+// RUN: llvm-profdata show -counts -function=main -ic-targets -memop-sizes %t.profdir/default_*.profraw | FileCheck %s
+
+#include <string.h>
+
+void (*f0)();
+void (*f1)();
+void (*f2)();
+
+char dst[200];
+char src[200];
+volatile int n;
+
+__attribute__((noinline)) void foo() {}
+
+__attribute__((noinline)) void bar() {
+ f0 = foo;
+ f1 = foo;
+ f2 = foo;
+ n = 4;
+}
+int main(int argc, char *argv[]) {
+ int i;
+ bar();
+ if (argc == 1) {
+ f0();
+ for (i = 0; i < 9; i++)
+ f1();
+ for (i = 0; i < 99; i++)
+ f2();
+ } else {
+ memcpy((void *)dst, (void *)src, n);
+ for (i = 0; i < 6; i++)
+ memcpy((void *)(dst + 2), (void *)src, n + 1);
+ for (i = 0; i < 66; i++)
+ memcpy((void *)(dst + 9), (void *)src, n + 2);
+ }
+}
+
+// CHECK: Counters:
+// CHECK: main:
+// CHECK: Hash: 0x00030012a7ab6e87
+// CHECK: Counters: 6
+// CHECK: Indirect Call Site Count: 3
+// CHECK: Number of Memory Intrinsics Calls: 3
+// CHECK: Block counts: [27, 297, 12, 132, 3, 2]
+// CHECK: Indirect Target Results:
+// CHECK: [ 0, foo, 3 ]
+// CHECK: [ 1, foo, 27 ]
+// CHECK: [ 2, foo, 297 ]
+// CHECK: Memory Intrinsic Size Results:
+// CHECK: [ 0, 4, 2 ]
+// CHECK: [ 1, 5, 12 ]
+// CHECK: [ 2, 6, 132 ]
+// CHECK: Instrumentation level: IR
+// CHECK: Functions shown: 1
+// CHECK: Total functions: 3
+// CHECK: Maximum function count: 327
+// CHECK: Maximum internal block count: 297
+// CHECK: Statistics for indirect call sites profile:
+// CHECK: Total number of sites: 3
+// CHECK: Total number of sites with values: 3
+// CHECK: Total number of profiled values: 3
+// CHECK: Value sites histogram:
+// CHECK: NumTargets, SiteCount
+// CHECK: 1, 3
+// CHECK: Statistics for memory intrinsic calls sizes profile:
+// CHECK: Total number of sites: 3
+// CHECK: Total number of sites with values: 3
+// CHECK: Total number of profiled values: 3
+// CHECK: Value sites histogram:
+// CHECK: NumTargets, SiteCount
+// CHECK: 1, 3
diff --git a/test/profile/instrprof-darwin-dead-strip.c b/test/profile/instrprof-darwin-dead-strip.c
index 03049335efda..6a2bffc213a3 100644
--- a/test/profile/instrprof-darwin-dead-strip.c
+++ b/test/profile/instrprof-darwin-dead-strip.c
@@ -1,7 +1,7 @@
// REQUIRES: osx-ld64-live_support
// REQUIRES: lto
-// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -o %t %s
+// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -o %t %s
// RUN: %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s -check-prefix=PROF
@@ -10,7 +10,7 @@
// RUN: otool -s __DATA __llvm_prf_names %t | FileCheck %s -check-prefix=PRF_NAMES
// RUN: otool -s __DATA __llvm_prf_cnts %t | FileCheck %s -check-prefix=PRF_CNTS
-// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -flto -o %t.lto %s
+// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -DCODE=1 -Wl,-dead_strip -flto -o %t.lto %s
// RUN: %run %t.lto
// RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw
// RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s -check-prefix=PROF
@@ -22,12 +22,24 @@
// Note: We expect foo() and some of the profiling data associated with it to
// be dead-stripped.
+// Note: When there is no code in a program, we expect to see the exact same
+// set of external functions provided by the profile runtime.
+
+// RUN: %clang_profgen -fcoverage-mapping -Wl,-dead_strip -dynamiclib -o %t.nocode.dylib %s
+// RUN: nm -jgU %t.nocode.dylib > %t.nocode.syms
+// RUN: nm -jgU %t | grep -vE "main|foo|mh_execute_header" > %t.code.syms
+// RUN: diff %t.nocode.syms %t.code.syms
+
+#ifdef CODE
+
// COV: [[@LINE+1]]{{ *}}|{{ *}}0|void foo()
void foo() {}
// COV: [[@LINE+1]]{{ *}}|{{ *}}1|int main
int main() { return 0; }
+#endif // CODE
+
// NM-NOT: foo
// PROF: Counters:
diff --git a/test/profile/instrprof-darwin-exports.c b/test/profile/instrprof-darwin-exports.c
new file mode 100644
index 000000000000..6667cabdb2df
--- /dev/null
+++ b/test/profile/instrprof-darwin-exports.c
@@ -0,0 +1,11 @@
+// REQUIRES: osx-ld64-live_support
+
+// Compiling with PGO/code coverage on Darwin should raise no warnings or errors
+// when using an exports list.
+
+// RUN: echo "_main" > %t.exports
+// RUN: %clang_pgogen -Werror -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee %t.log
+// RUN: %clang_profgen -Werror -fcoverage-mapping -Wl,-exported_symbols_list,%t.exports -o %t %s 2>&1 | tee -a %t.log
+// RUN: cat %t.log | count 0
+
+int main() {}
diff --git a/test/profile/instrprof-dlopen-dlclose-gcov.test b/test/profile/instrprof-dlopen-dlclose-gcov.test
new file mode 100644
index 000000000000..0444fca2692c
--- /dev/null
+++ b/test/profile/instrprof-dlopen-dlclose-gcov.test
@@ -0,0 +1,30 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c
+RUN: %clang --coverage -o func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c
+RUN: %clang --coverage -o func3.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func3.c
+RUN: %clang --coverage -o %t -fPIC -rpath %t.d %S/Inputs/instrprof-dlopen-dlclose-main.c
+
+# Test with two dlopened libraries.
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-dlclose-main.c.gcov %S/Inputs/instrprof-dlopen-dlclose-main.c.gcov
+RUN: llvm-cov gcov instrprof-dlopen-func.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func.c.gcov %S/Inputs/instrprof-dlopen-func.c.gcov
+RUN: llvm-cov gcov instrprof-dlopen-func2.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func2.c.gcov
+RUN: rm instrprof-dlopen-dlclose-main.gcda instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda
+
+# Test with three dlopened libraries.
+RUN: %clang -DUSE_LIB3 --coverage -o %t -fPIC -rpath %t.d %S/Inputs/instrprof-dlopen-dlclose-main.c
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-dlopen-dlclose-main.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-dlclose-main.c.gcov %S/Inputs/instrprof-dlopen-dlclose-main_three-libs.c.gcov
+RUN: llvm-cov gcov instrprof-dlopen-func.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func.c.gcov %S/Inputs/instrprof-dlopen-func.c.gcov
+RUN: llvm-cov gcov instrprof-dlopen-func2.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func2.c.gcov
+RUN: llvm-cov gcov instrprof-dlopen-func3.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-dlopen-func2.c.gcov %S/Inputs/instrprof-dlopen-func3.c.gcov
+RUN: rm instrprof-dlopen-dlclose-main.gcda instrprof-dlopen-func.gcda instrprof-dlopen-func2.gcda instrprof-dlopen-func3.gcda
diff --git a/test/profile/instrprof-gcov-__gcov_flush-terminate.test b/test/profile/instrprof-gcov-__gcov_flush-terminate.test
new file mode 100644
index 000000000000..aa51461a3bd0
--- /dev/null
+++ b/test/profile/instrprof-gcov-__gcov_flush-terminate.test
@@ -0,0 +1,12 @@
+XFAIL: *
+
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c
+RUN: test -f instrprof-gcov-__gcov_flush-terminate.gcno
+
+RUN: rm -f instrprof-gcov-__gcov_flush-terminate.gcda
+RUN: %expect_crash %run %t
+RUN: llvm-cov gcov instrprof-gcov-__gcov_flush-terminate.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-__gcov_flush-terminate.c.gcov %S/Inputs/instrprof-gcov-__gcov_flush-terminate.c.gcov
diff --git a/test/profile/instrprof-gcov-exceptions.test b/test/profile/instrprof-gcov-exceptions.test
new file mode 100644
index 000000000000..20ca47a9528b
--- /dev/null
+++ b/test/profile/instrprof-gcov-exceptions.test
@@ -0,0 +1,21 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+# Test with exceptions disabled.
+RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp -fno-exceptions
+RUN: test -f instrprof-gcov-exceptions.gcno
+
+RUN: rm -f instrprof-gcov-exceptions.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-exceptions.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-exceptions.cpp.gcov %S/Inputs/instrprof-gcov-exceptions.cpp.gcov
+
+# Test with exceptions enabled, the result in terms of line counts should be the same.
+RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp
+RUN: test -f instrprof-gcov-exceptions.gcno
+
+RUN: rm -f instrprof-gcov-exceptions.gcda
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-gcov-exceptions.gcda
+# The result should be the same, not using XFAIL as only this part of the test is failing.
+RUN: not FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-exceptions.cpp.gcov %S/Inputs/instrprof-gcov-exceptions.cpp.gcov
diff --git a/test/profile/instrprof-gcov-multiple-bbs-single-line.test b/test/profile/instrprof-gcov-multiple-bbs-single-line.test
new file mode 100644
index 000000000000..8839455189ee
--- /dev/null
+++ b/test/profile/instrprof-gcov-multiple-bbs-single-line.test
@@ -0,0 +1,13 @@
+XFAIL: *
+
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c
+RUN: test -f instrprof-gcov-multiple-bbs-single-line.gcno
+
+RUN: rm -f instrprof-gcov-multiple-bbs-single-line.gcda
+RUN: %run %t
+RUN: llvm-cov gcov -b -c instrprof-gcov-multiple-bbs-single-line.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-multiple-bbs-single-line.c.gcov %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c.gcov
+RUN: rm instrprof-gcov-multiple-bbs-single-line.gcda
diff --git a/test/profile/instrprof-gcov-two-objects.test b/test/profile/instrprof-gcov-two-objects.test
new file mode 100644
index 000000000000..a53d51dce8ed
--- /dev/null
+++ b/test/profile/instrprof-gcov-two-objects.test
@@ -0,0 +1,18 @@
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o instrprof-shared-lib.o -c %S/Inputs/instrprof-shared-lib.c
+RUN: test -f instrprof-shared-lib.gcno
+
+RUN: %clang --coverage -o instrprof-shared-main.o -c %S/Inputs/instrprof-shared-main.c
+RUN: test -f instrprof-shared-main.gcno
+
+RUN: %clang --coverage -o %t instrprof-shared-main.o instrprof-shared-lib.o
+RUN: test -f %t
+
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-shared-main.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main.c.gcov %S/Inputs/instrprof-shared-main.c.gcov
+RUN: llvm-cov gcov instrprof-shared-lib.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib_in-loop.c.gcov
+RUN: rm instrprof-shared-main.gcda instrprof-shared-lib.gcda
diff --git a/test/profile/instrprof-get-filename.c b/test/profile/instrprof-get-filename.c
new file mode 100644
index 000000000000..031b75f12f3c
--- /dev/null
+++ b/test/profile/instrprof-get-filename.c
@@ -0,0 +1,39 @@
+// Test __llvm_profile_get_filename.
+// RUN: %clang_pgogen -O2 -o %t %s
+// RUN: %run %t
+
+#include <stdio.h>
+#include <string.h>
+
+const char *__llvm_profile_get_filename();
+void __llvm_profile_set_filename(const char *);
+
+int main(int argc, const char *argv[]) {
+ int i;
+ const char *filename;
+ const char *new_filename = "/path/to/test.profraw";
+
+ filename = __llvm_profile_get_filename();
+ if (strncmp(filename, "default_", 8)) {
+ fprintf(stderr,
+ "Error: got filename %s, expected it to start with 'default_'\n",
+ filename);
+ return 1;
+ }
+ if (strcmp(filename + strlen(filename) - strlen(".profraw"), ".profraw")) {
+ fprintf(stderr,
+ "Error: got filename %s, expected it to end with '.profraw'\n",
+ filename);
+ return 1;
+ }
+
+ __llvm_profile_set_filename(new_filename);
+ filename = __llvm_profile_get_filename();
+ if (strcmp(filename, new_filename)) {
+ fprintf(stderr, "Error: got filename %s, expected '%s'\n", filename,
+ new_filename);
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/test/profile/instrprof-path.c b/test/profile/instrprof-path.c
index 28ee8ad0a484..90cb1df198f0 100644
--- a/test/profile/instrprof-path.c
+++ b/test/profile/instrprof-path.c
@@ -12,7 +12,7 @@
#include <string.h>
const char *__llvm_profile_get_path_prefix();
-void __llvm_profile_set_filanem(const char*);
+void __llvm_profile_set_filename(const char*);
int main(int argc, const char *argv[]) {
int i;
diff --git a/test/profile/instrprof-reset-counters.c b/test/profile/instrprof-reset-counters.c
index e8892366bcfe..f15bc0d8e3a1 100644
--- a/test/profile/instrprof-reset-counters.c
+++ b/test/profile/instrprof-reset-counters.c
@@ -12,7 +12,7 @@ int main(void) {
return 0;
}
void foo(int N) {
- // CHECK-LABEL: define void @foo(
+ // CHECK-LABEL: define{{( dso_local)?}} void @foo(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[FOO:[0-9]+]]
if (N) {}
}
diff --git a/test/profile/instrprof-shared-gcov-flush.test b/test/profile/instrprof-shared-gcov-flush.test
new file mode 100644
index 000000000000..50292b6336c4
--- /dev/null
+++ b/test/profile/instrprof-shared-gcov-flush.test
@@ -0,0 +1,52 @@
+# This test fails on Mac (https://bugs.llvm.org/show_bug.cgi?id=38134)
+XFAIL: darwin
+
+RUN: mkdir -p %t.d
+RUN: cd %t.d
+
+RUN: %clang --coverage -o libfunc.so -fPIC -shared %S/Inputs/instrprof-shared-lib.c
+RUN: test -f instrprof-shared-lib.gcno
+
+# Test the case where we exit abruptly after calling __gcov_flush, which means we don't write out the counters at exit.
+RUN: %clang -DEXIT_ABRUPTLY -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c
+RUN: test -f instrprof-shared-main-gcov-flush.gcno
+
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_no-writeout.c.gcov
+RUN: llvm-cov gcov instrprof-shared-lib.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov
+RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
+
+# Test the case where we exit normally and we have a call to the shared library function before __gcov_flush.
+RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c
+RUN: test -f instrprof-shared-main-gcov-flush.gcno
+
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before.c.gcov
+RUN: llvm-cov gcov instrprof-shared-lib.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov
+RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
+
+# Test the case where we exit normally and we have a call to the shared library function after __gcov_flush.
+RUN: %clang -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c
+RUN: test -f instrprof-shared-main-gcov-flush.gcno
+
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-after.c.gcov
+RUN: llvm-cov gcov instrprof-shared-lib.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib.c.gcov
+RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
+
+# Test the case where we exit normally and we have calls to the shared library function before and after __gcov_flush.
+RUN: %clang -DSHARED_CALL_BEFORE_GCOV_FLUSH -DSHARED_CALL_AFTER_GCOV_FLUSH --coverage -o %t -L%t.d -rpath %t.d -lfunc %S/Inputs/instrprof-shared-main-gcov-flush.c
+RUN: test -f instrprof-shared-main-gcov-flush.gcno
+
+RUN: %run %t
+RUN: llvm-cov gcov instrprof-shared-main-gcov-flush.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-main-gcov-flush.c.gcov %S/Inputs/instrprof-shared-main-gcov-flush_shared-call-before-after.c.gcov
+RUN: llvm-cov gcov instrprof-shared-lib.gcda
+RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-shared-lib.c.gcov %S/Inputs/instrprof-shared-lib_called-twice.c.gcov
+RUN: rm instrprof-shared-main-gcov-flush.gcda instrprof-shared-lib.gcda
diff --git a/test/profile/instrprof-visibility.cpp b/test/profile/instrprof-visibility.cpp
index 6fbba9defc56..bb533050e059 100644
--- a/test/profile/instrprof-visibility.cpp
+++ b/test/profile/instrprof-visibility.cpp
@@ -1,8 +1,8 @@
// RUN: %clangxx_profgen -fcoverage-mapping %S/Inputs/instrprof-visibility-helper.cpp -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge %t.profraw -o %t.profdata
-// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s --check-prefix=PROFILE
-// RUN: llvm-cov show %t -instr-profile=%t.profdata | FileCheck %s --check-prefix=COV
+// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=PROFILE
+// RUN: llvm-cov show %t -instr-profile=%t.profdata | FileCheck -allow-deprecated-dag-overlap %s --check-prefix=COV
namespace {
#define NO_WEAK