Add debug msg to dump_file in add_new_function
authorTom de Vries <tom@codesourcery.com>
Mon, 8 Jun 2015 08:57:39 +0000 (08:57 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Mon, 8 Jun 2015 08:57:39 +0000 (08:57 +0000)
2015-06-08  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/66435
* cgraphunit.c (cgraph_node::add_new_function): Dump message on new
function.

* gcc.dg/gomp/notify-new-function-2.c: New test.
* gcc.dg/gomp/notify-new-function-3.c: Same.
* gcc.dg/gomp/notify-new-function.c: Same.

From-SVN: r224209

gcc/ChangeLog
gcc/cgraphunit.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/notify-new-function.c [new file with mode: 0644]

index e1bd305f9739441c174587a79e4b3dfdcb14b241..bd1c4b0a37c3567d9389036df1ba727bb1ebf204 100644 (file)
@@ -1,3 +1,9 @@
+2015-06-08  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/66435
+       * cgraphunit.c (cgraph_node::add_new_function): Dump message on new
+       function.
+
 2015-06-06  Jan Hubicka  <hubicka@ucw.cz>
 
        * alias.c (get_alias_set): Be ready for TYPE_CANONICAL
index 722c4f4d0634d1c18ebd2de91f89d6c9ac61e0d1..6a1f0c1dd2f51e4e38ac2fbfef8f2361658e29de 100644 (file)
@@ -507,6 +507,23 @@ cgraph_node::add_new_function (tree fndecl, bool lowered)
 {
   gcc::pass_manager *passes = g->get_passes ();
   cgraph_node *node;
+
+  if (dump_file)
+    {
+      struct function *fn = DECL_STRUCT_FUNCTION (fndecl);
+      const char *function_type = ((gimple_has_body_p (fndecl))
+                                  ? (lowered
+                                     ? (gimple_in_ssa_p (fn)
+                                        ? "ssa gimple"
+                                        : "low gimple")
+                                     : "high gimple")
+                                  : "to-be-gimplified");
+      fprintf (dump_file,
+              "Added new %s function %s to callgraph\n",
+              function_type,
+              fndecl_name (fndecl));
+    }
+
   switch (symtab->state)
     {
       case PARSING:
index 71d38586c446aeb8c21088c9e10ddd1c3d5e4f42..913bd036e9ac5945c0a57aa062d507af7eda5707 100644 (file)
@@ -1,3 +1,10 @@
+2015-06-08  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/66435
+       * gcc.dg/gomp/notify-new-function-2.c: New test.
+       * gcc.dg/gomp/notify-new-function-3.c: Same.
+       * gcc.dg/gomp/notify-new-function.c: Same.
+
 2015-06-06  Jan Hubicka  <hubicka@ucw.cz>
 
        * gfortran.dg/lto/bind_c-1_0.f90: New testcase.
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function-2.c
new file mode 100644 (file)
index 0000000..e9c8939
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-omplower" } */
+
+void __attribute__((noinline))
+baz (int *p)
+{
+}
+
+void
+foo (void)
+{
+  int p[2];
+  p[0] = 1;
+  p[1] = 3;
+  #pragma omp task firstprivate (p)
+    baz (p);
+}
+
+/* Check for new function notification in omplower dump.  */
+/* { dg-final { scan-tree-dump-times "Added new high gimple function foo\\._omp_cpyfn\\.1 to callgraph" 1 "omplower" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function-3.c
new file mode 100644 (file)
index 0000000..f173b8e
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-ompexpssa" } */
+
+void
+foo (int *__restrict a, int *__restrict b, int *__restrict c)
+{
+  int i;
+  for (i = 0; i < 1000; ++i)
+    c[i] = a[i] + b[i];
+}
+
+
+/* Check for new function notification in ompexpssa dump.  */
+/* { dg-final { scan-tree-dump-times "Added new ssa gimple function foo\\._loopfn\\.0 to callgraph" 1 "ompexpssa" } } */
diff --git a/gcc/testsuite/gcc.dg/gomp/notify-new-function.c b/gcc/testsuite/gcc.dg/gomp/notify-new-function.c
new file mode 100644 (file)
index 0000000..4770a6b
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fopenmp -fdump-tree-ompexp" } */
+
+int
+main (void)
+{
+#pragma omp parallel
+  {
+    extern void foo (void);
+    foo ();
+  }
+  return 0;
+}
+
+
+/* Check for new function notification in ompexp dump.  */
+/* { dg-final { scan-tree-dump-times "Added new low gimple function main\\._omp_fn\\.0 to callgraph" 1 "ompexp" } } */