aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c b/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
new file mode 100644
index 0000000..43a9090
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/clone-merge-1.c
@@ -0,0 +1,34 @@
+/* { dg-options "-O3 -fno-early-inlining -fdump-ipa-afdo_offline-all" } */
+/* { dg-require-profiling "-fauto-profile" } */
+
+__attribute__ ((used))
+int a[1000];
+
+__attribute__ ((noinline))
+void
+test2(int sz)
+{
+ a[sz]++;
+ asm volatile (""::"m"(a));
+}
+
+__attribute__ ((noinline))
+void
+test1 (int sz)
+{
+ for (int i = 0; i < 1000; i++)
+ if (i % 2)
+ test2 (sz);
+ else
+ test2 (i);
+
+}
+int main()
+{
+ for (int i = 0; i < 1000; i++)
+ test1 (1000);
+ return 0;
+}
+/* We will have profiles for test2 and test2.constprop.0 that will have to be
+ merged, */
+/* { dg-final-use-autofdo { scan-ipa-dump "Merging duplicate symbol test2" "afdo_offline"} } */