summaryrefslogtreecommitdiff
path: root/test/profile/Inputs/instrprof-shared-lib.c
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-11-13 22:33:07 +0000
committerXinliang David Li <davidxl@google.com>2015-11-13 22:33:07 +0000
commit8f5633c1a7812ec4c8b549c67675b98c1dade82a (patch)
treea85dfd6e42d359e0ea3644d9995e2b2f728449b2 /test/profile/Inputs/instrprof-shared-lib.c
parentb3d951765ae9be108e3b8f6e8223a5fe8eeb1939 (diff)
[PGO] Ensure profile section symbols are created (linux)
- This is to handle a corner case where profile lib is linked in but non of the modules are instrumented (On linux, since we avoided the overhead to emit runtime hook use functions so this is the side effect of that size optimization). - Added a profile runtime test case to cover all scenarios of shared library builds. Differential Revision: http://reviews.llvm.org/D14468 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253098 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/profile/Inputs/instrprof-shared-lib.c')
-rw-r--r--test/profile/Inputs/instrprof-shared-lib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/profile/Inputs/instrprof-shared-lib.c b/test/profile/Inputs/instrprof-shared-lib.c
new file mode 100644
index 000000000..d22b0a54a
--- /dev/null
+++ b/test/profile/Inputs/instrprof-shared-lib.c
@@ -0,0 +1,9 @@
+int g1 = 0;
+int g2 = 1;
+
+void foo(int n) {
+ if (n % 5 == 0)
+ g1++;
+ else
+ g2++;
+}