aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C
new file mode 100644
index 000000000..dbae8d774
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_5.C
@@ -0,0 +1,41 @@
+/* Check if cutting off callgraph and using sort_name_prefix gets all functions laid out
+ according to prefixes. foo_200 is almost as hot as the other foo's but should
+ not be grouped with them as it has a different section prefix and sort_name_prefix is
+ turned on. */
+/* { dg-require-section-exclude "" } */
+/* { dg-require-linker-function-reordering-plugin "" } */
+/* { dg-options "-O2 -freorder-functions=callgraph -ffunction-sections -Wl,-plugin-opt,file=linker.dump,-plugin-opt,edge_cutoff=p100,-plugin-opt,sort_name_prefix=yes" } */
+
+int __attribute__ ((noinline, section(".text.unlikely._Z7foo_200v")))
+foo_200 ()
+{
+ return 1;
+}
+
+int __attribute__ ((noinline))
+foo_100 ()
+{
+ return 1;
+}
+
+int __attribute__ ((noinline))
+foo_300 ()
+{
+ return 1;
+}
+int main ()
+{
+ int sum = 0;
+ for (int i = 0; i< 200; i++)
+ sum += foo_200 ();
+ for (int i = 0; i< 100; i++)
+ sum += foo_100 ();
+ for (int i = 0; i< 300; i++)
+ sum += foo_300 ();
+ return sum - 600;
+}
+
+/* { dg-final-use { scan-file-not linker.dump "Callgraph group" } } */
+/* { dg-final-use { scan-file linker.dump ".text.unlikely._Z7foo_200v entry count = 200 computed = 200 max count = 200" } } */
+/* { dg-final-use { scan-file linker.dump "\.text\.unlikely\._Z7foo_200v.*\n\.text\.*\._Z7foo_100v.*\n\.text\.*\._Z7foo_300v.*\n" } } */
+/* { dg-final-use { remove-build-file "linker.dump" } } */