aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-prof
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/tree-prof')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C2
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt1
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h5
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C9
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C2
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C48
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C14
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h16
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h15
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C10
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C38
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C91
18 files changed, 337 insertions, 2 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C
index c58f3ca94..9c532c195 100644
--- a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C
@@ -38,7 +38,7 @@ int main ()
/* { dg-final-use { scan-assembler "\.string \"Weight 1000 1000\"" } } */
/* { dg-final-use { scan-assembler "\.string \"Weight 1001 1001\"" } } */
/* Check if main is next to foo or bar */
-/* { dg-final-use { scan-file linker.dump "Callgraph group : *\(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } } */
+/* { dg-final-use { scan-file linker.dump "Callgraph group : *\.*(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } } */
/* { dg-final-use { scan-file linker.dump ".text\..*\._Z9notcalledv entry count = 0 computed = 0 max count = 0" } } */
/* { dg-final-use { scan-file linker.dump "Moving .* section\\(s\\) to new segment" } } */
/* { dg-final-use { cleanup-saved-temps } } */
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt
new file mode 100644
index 000000000..c7a82f77e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt
@@ -0,0 +1 @@
+Test -fprofile-generate-buildinfo option
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h
new file mode 100644
index 000000000..bf28164a0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h
@@ -0,0 +1,5 @@
+class Foo
+{
+ public:
+ int foo(int x) { return x; }
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C
new file mode 100644
index 000000000..7743a0b36
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C
@@ -0,0 +1,9 @@
+/* { dg-options "-O2 -fno-inline -fprofile-generate-buildinfo=$srcdir/g++.dg/tree-prof/lipo/buildinfo.txt" } */
+#include <stdio.h>
+
+extern int foo1(int x);
+extern int foo2(int x);
+int main()
+{
+ printf ("Result = %d\n", foo1(1) + foo2(1));
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C
new file mode 100644
index 000000000..5f24dc1eb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C
@@ -0,0 +1,7 @@
+/* { dg-options "-O2 -fno-inline" } */
+#include "comdat_fixup.h"
+int foo1(int x)
+{
+ Foo f;
+ return f.foo(x);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C
new file mode 100644
index 000000000..1416129c0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C
@@ -0,0 +1,7 @@
+/* { dg-options "-O2 -fno-inline" } */
+#include "comdat_fixup.h"
+int foo2(int x)
+{
+ Foo f;
+ return f.foo(x);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C
index b34b937fd..78fd0c583 100644
--- a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=1" } */
struct A {
A () {}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
new file mode 100644
index 000000000..525480dab
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C
@@ -0,0 +1,48 @@
+// { dg-options "-std=c++11 -O2" }
+
+// A test case for static var promotion on targets like powerpc, where
+// the static initializer data is loaded via indirection through
+// TOC. Ensure that the global label for static initializer data is
+// unique via *.cmo* suffix.
+
+// Bug: after static var promotion in two different modules, we have
+// the following which leads to multiple definition of ._41" error during
+// link time.
+
+// Module 1 Module 2
+// .hidden ._41.cmo.1 .hidden ._41.cmo.3
+// .globl ._41 .globl ._41
+// ._41: ._41:
+// ... ...
+
+
+// Instead we should use the appropriate unique names for initializer
+// data as in the following.
+
+// Module 1 Module 2
+// .hidden ._41.cmo.1 .hidden ._41.cmo.3
+// .globl ._41.cmo.1 .globl ._41.cmo.3
+// ._41.cmo.1: ._41.cmo.3:
+// ... ...
+
+class A {
+ public:
+ int f(int x) const;
+};
+
+class B {
+ public:
+ int f(int x) const;
+};
+
+int main()
+{
+ A *a = new A();
+ B *b = new B();
+ int total = 0;
+ for (int i=0; i<3; ++i) {
+ total += a->f(1);
+ total += b->f(1);
+ }
+ return (total > 0) ? 0 : 1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C
new file mode 100644
index 000000000..0236e16d3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C
@@ -0,0 +1,14 @@
+/* { dg-options "-std=c++11 -O2" } */
+
+#include <vector>
+
+class A {
+ public:
+ int f(int x) const;
+};
+
+static const std::vector<int> point1_{42};
+
+int A::f(int x) const {
+ return x+1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C
new file mode 100644
index 000000000..d39095de5
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C
@@ -0,0 +1,14 @@
+/* { dg-options "-std=c++11 -O2" } */
+
+#include <vector>
+
+class B {
+ public:
+ int f(int x) const;
+};
+
+static const std::vector<int> point2_{43};
+
+int B::f(int x) const {
+ return x+1;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h
new file mode 100644
index 000000000..5eb102d74
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h
@@ -0,0 +1,16 @@
+extern int NextId();
+
+class TLSClass {
+ public:
+ TLSClass() {
+ id = NextId();
+ bar = 1;
+ }
+ ~TLSClass() {}
+ int id;
+ int bar;
+};
+extern TLSClass* NextTLSClass();
+extern void *SetTLSClass(TLSClass *a);
+extern TLSClass *GetTLSClass();
+extern thread_local TLSClass* current_tls_;
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h
new file mode 100644
index 000000000..9ba0945c2
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h
@@ -0,0 +1,15 @@
+extern int NextId();
+
+class TLSClass {
+ public:
+ TLSClass() {
+ id = NextId();
+ bar = 1;
+ }
+ ~TLSClass() {}
+ int id;
+ int bar;
+};
+extern TLSClass* NextTLSClass();
+extern void *SetTLSClass(TLSClass *a);
+extern TLSClass *GetTLSClass();
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C
new file mode 100644
index 000000000..9ccd5b96b
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C
@@ -0,0 +1,10 @@
+// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" }
+#include "tls2.h"
+
+static thread_local TLSClass* current_tls_ = NextTLSClass();
+void *SetTLSClass(TLSClass *a) {
+ current_tls_ = a;
+}
+TLSClass *GetTLSClass() {
+ return current_tls_;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C
new file mode 100644
index 000000000..43c108526
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C
@@ -0,0 +1,31 @@
+// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" }
+#include <stdio.h>
+#include <stdlib.h>
+#include <new>
+#include "tls2.h"
+TLSClass* NextTLSClass() {
+ return new TLSClass();
+}
+int NextId() {
+ static int id = 0;
+ return id++;
+}
+static thread_local TLSClass* current_tls2_ = NextTLSClass();
+void *SetTLSClass2(TLSClass *a) {
+ current_tls2_ = a;
+}
+int main() {
+ int i = 0;
+ if (GetTLSClass()->id != i++)
+ abort();
+ TLSClass *A = NextTLSClass();
+ SetTLSClass(A);
+ if (GetTLSClass()->id != i++)
+ abort();
+ if (current_tls2_->id != i++)
+ abort();
+ A = NextTLSClass();
+ SetTLSClass2(A);
+ if (current_tls2_->id != i++)
+ abort();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C
new file mode 100644
index 000000000..f3e5e376e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C
@@ -0,0 +1,10 @@
+// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" }
+#include "tls.h"
+
+thread_local TLSClass* current_tls_ = NextTLSClass();
+void *SetTLSClass(TLSClass *a) {
+ current_tls_ = a;
+}
+TLSClass *GetTLSClass() {
+ return current_tls_;
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C
new file mode 100644
index 000000000..fcf8c2101
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C
@@ -0,0 +1,38 @@
+// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" }
+#include <stdio.h>
+#include <stdlib.h>
+#include <new>
+#include "tls.h"
+TLSClass* NextTLSClass() {
+ return new TLSClass();
+}
+int NextId() {
+ static int id = 0;
+ return id++;
+}
+void *SetTLSClassHere(TLSClass *a) {
+ current_tls_ = a;
+}
+thread_local TLSClass* current_tls2_ = NextTLSClass();
+void *SetTLSClass2(TLSClass *a) {
+ current_tls2_ = a;
+}
+int main() {
+ int i = 0;
+ if (GetTLSClass()->id != i++)
+ abort();
+ TLSClass *A = NextTLSClass();
+ SetTLSClass(A);
+ if (GetTLSClass()->id != i++)
+ abort();
+ A = NextTLSClass();
+ SetTLSClassHere(A);
+ if (GetTLSClass()->id != i++)
+ abort();
+ if (current_tls2_->id != i++)
+ abort();
+ A = NextTLSClass();
+ SetTLSClass2(A);
+ if (current_tls2_->id != i++)
+ abort();
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C
new file mode 100644
index 000000000..b1225a0f8
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C
@@ -0,0 +1,19 @@
+// Check if patching works with function splitting.
+// { dg-require-effective-target freorder }
+// { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition " { target { ! x86_64-*-* } } }
+// { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition -mpatch-functions-for-instrumentation -fno-optimize-sibling-calls " { target x86_64-*-* } }
+
+int k;
+
+int
+main ()
+{
+ try
+ {
+ if (k)
+ throw 6;
+ }
+ catch (...)
+ {
+ }
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C
new file mode 100644
index 000000000..c8caf0765
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C
@@ -0,0 +1,91 @@
+// { dg-require-effective-target freorder }
+/* { dg-options "-O2 -g -fno-peel-loops" } */
+
+struct page {
+ int i;
+} global;
+
+__attribute__((noinline)) static struct page* find_page1 (int i)
+{
+ if ( i< 150)
+ return 0;
+ global.i = i;
+ return &global;
+}
+
+__attribute__((noinline)) static struct page* find_page2 (int i)
+{
+ global.i = i;
+ return &global;
+}
+
+volatile int ii;
+__attribute__((noinline)) static int zero (void)
+{
+ return ii;
+}
+
+static inline int uptodate (struct page* p)
+{
+ return (p->i < 709);
+}
+
+static struct page* bar(int i)
+{
+ struct page *page;
+
+repeat:
+ page = find_page1 (i);
+ if (!page) {
+ page = find_page2 (i);
+ if (!page)
+ return 0;
+ if (zero () ) {
+ zero ();
+ goto repeat;
+ }
+ }
+ return page;
+}
+
+__attribute__((noinline)) int foo (int n)
+{
+ struct page *page;
+
+retry:
+ page = bar (n);
+ if (page == 0)
+ return 0;
+ if (uptodate (page))
+ goto out;
+
+ zero ();
+ if (page->i < 0) {
+ zero ();
+ goto retry;
+ }
+out:
+ return 1;
+}
+
+__attribute__((noinline)) int hot (void)
+{
+ int i;
+ int sum = 0;
+
+ for (i = 0; i < 433038; i++)
+ sum+=i;
+
+ return sum;
+}
+
+int main(void)
+{
+ int i;
+
+ global.i = hot ();
+ for (i = 0; i < 858; i++)
+ foo (i);
+
+ return 0;
+}