]> gcc.gnu.org Git - gcc.git/commitdiff
re PR tree-optimization/1046 (gcc less efficient than jdk for recursion with -finline...
authorJan Hubicka <jh@suse.cz>
Thu, 11 Jan 2007 16:44:56 +0000 (17:44 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 11 Jan 2007 16:44:56 +0000 (16:44 +0000)
PR tree-optimization/1046
* tree-tailcall.c (suitable_for_tail_call_opt_p): Use TREE_ADDRESSABLE
when alias info is not ready.
(pass_tail_recursion): Do not require aliasing.
* tree-ssa-copyrename.c (pass_rename_ssa_cop): Likewise.
* tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Likewise.
* tree-ssa-copy.c (pass_copy_prop): Likewise.
* tree-ssa-forwprop.c (pass_forwprop): Likewise.
* tree-ssa-dce.c (pass_dce, pass_dce_loop, pass_cd_dce): Likewise.
* passes.c (init_optimization_passes): Execute rename_ssa_copies,
ccp, forwprop, copy_prop, merge_phi, copy_prop, dce and tail recursion
before inlining.
* tree-ssa-operands.c (add_virtual_operand, get_indirect_ref_operand):
When aliasing is not build, mark statement as volatile.

From-SVN: r120680

12 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/always_inline3.c
gcc/testsuite/gcc.dg/tree-ssa/pr15349.c
gcc/testsuite/gcc.dg/tree-ssa/pr20701.c
gcc/testsuite/gcc.dg/tree-ssa/pr21658.c
gcc/testsuite/gcc.dg/tree-ssa/pr25501.c
gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-1.c
gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-2.c
gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-3.c
gcc/testsuite/gcc.dg/tree-ssa/tailrecursion-4.c
gcc/testsuite/gcc.dg/tree-ssa/vrp05.c
gcc/testsuite/gcc.dg/tree-ssa/vrp11.c

index 9f52d1015e216273f5b5ca3c0ca33f21288a7960..c63f07418b73ecce86a5d62b7daa4431c3809a62 100644 (file)
@@ -1,3 +1,18 @@
+2007-01-11  Jan Hubicka  <jh@suse.cz>
+
+       * gcc.dg/tree-ssa/tailrecursion-4.c: Update dump file.
+       * gcc.dg/tree-ssa/tailrecursion-1.c: Update dump file.
+       * gcc.dg/tree-ssa/tailrecursion-2.c: Update dump file.
+       * gcc.dg/tree-ssa/tailrecursion-3.c: Update dump file.
+       * gcc.dg/tree-ssa/pr21658.c: Likewise.
+       * gcc.dg/tree-ssa/pr15349.c: Likewise.
+       * gcc.dg/tree-ssa/pr25501.c: Likewise.
+       * gcc.dg/tree-ssa/vrp11.c: Make more complex so it still test
+       transformation in question.
+       * gcc.dg/tree-ssa/vrp05.c: Likewise.
+       * gcc.dg/tree-ssa/pr20701.c: Likewise.
+       * gcc.dg/always_inline3.c: Likewise.
+
 2007-01-10  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/28999
index b183770adc005753ee996cbfa955cb386fbae89e..e1a337c2864bac3c9cb194c91f6d5ea9c2b3d0c7 100644 (file)
@@ -1,8 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-Winline -O2" } */
+void do_something_evil (void);
 inline __attribute__ ((always_inline)) void
 q2(void)
 {                              /* { dg-error "recursive" "" } */
+  do_something_evil ();
   q2();                        /* { dg-error "called from here" "" } */
   q2();                        /* { dg-error "called from here" "" } */
 }
index 5c440e60775117b4107b28f089a4f3a9dc37137c..080aa81b504e56fdf139d911dc6f57e1a6ff2913 100644 (file)
@@ -22,5 +22,5 @@ foo (int a, int b)
   return t;
 }
 
-/* { dg-final { scan-tree-dump-times "PHI" 1 "mergephi"} } */
-/* { dg-final { cleanup-tree-dump "mergephi" } } */
+/* { dg-final { scan-tree-dump-times "PHI" 1 "mergephi2"} } */
+/* { dg-final { cleanup-tree-dump "mergephi2" } } */
index 708bee19d32fe22bcd952eb4cff77f152a3e18df..6721155fc9a251b5d30858208223de89a2ccb7fe 100644 (file)
@@ -1,30 +1,39 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp2 -fno-early-inlining" } */
 
 typedef struct {
   int code;
 } *rtx;
 
+static inline void *zero ()
+{
+  return 0;
+}
+static inline int three ()
+{
+  return 3;
+}
+
 int
 can_combine_p (rtx insn, rtx elt)
 {
   rtx set;
 
-  set = 0;
-  if (insn->code == 3)
+  set = zero ();
+  if (insn->code == three ())
     set = insn;
   else
     {
       set = elt;
-      if (set == 0)
+      if (set == zero ())
        return 0;
     }
 
-  if (set == 0)
+  if (set == zero ())
     return 1;
 
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp1" } } */
-/* { dg-final { cleanup-tree-dump "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp2" } } */
+/* { dg-final { cleanup-tree-dump "vrp2" } } */
index 2fa45b40a71b0fe6c9101c219a0efc9d3fb7f4f0..16893b071f346ec3e1e83f3c688a8c0c56ef27bc 100644 (file)
@@ -17,5 +17,5 @@ f (void)
     link_error ();
 }
 
-/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp"} } */
-/* { dg-final { cleanup-tree-dump "ccp" } } */
+/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "ccp1"} } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
index aa70994756c520ec8a16519f3369c06eeb96c3a6..7fb2bcc8ac6dbca126cede21c214fbedb410cd82 100644 (file)
@@ -32,5 +32,5 @@ foo (int a)
   return 13;
 }
 
-/* { dg-final { scan-tree-dump-times "Removing basic block" 0 "mergephi"} } */
+/* { dg-final { scan-tree-dump-times "Removing basic block" 0 "mergephi1"} } */
 /* { dg-final { cleanup-tree-dump "mergephi" } } */
index 8802bc8bc69fa5f9d1b1f8758be41d6f612b32cf..64de788ec6df681ba8045a3c72e321f547820700 100644 (file)
@@ -8,5 +8,5 @@ t(int a)
        else
                return 0;
 }
-/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */
-/* { dg-final { cleanup-tree-dump "tailr" } } */
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr1"} } */
+/* { dg-final { cleanup-tree-dump "tailr1" } } */
index 9fe3af9855ad202d8a60cbd6170aee194ebfc321..9ef4fdb6d2e31b5e715f5f5c554898be93faf53b 100644 (file)
@@ -9,5 +9,5 @@ t(char *a)
        else
                return 0;
 }
-/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */
-/* { dg-final { cleanup-tree-dump "tailr" } } */
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr1"} } */
+/* { dg-final { cleanup-tree-dump "tailr1" } } */
index ca727df391d45f4541928bb5b4f8d51de1d3c932..37b19af0e54045c19fdce078ffe7592b4eff9eca 100644 (file)
@@ -12,5 +12,5 @@ t(int a)
                r=r;
        return r;
 }
-/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr"} } */
-/* { dg-final { cleanup-tree-dump "tailr" } } */
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 1 "tailr1"} } */
+/* { dg-final { cleanup-tree-dump "tailr1" } } */
index bb43d76aca9035d1be00a72b4ac10395db2a21a8..34689e64168295d670865875724516937a4c15ed 100644 (file)
@@ -14,5 +14,5 @@ t(int a)
                r=r;
        return r;
 }
-/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 2 "tailr"} } */
-/* { dg-final { cleanup-tree-dump "tailr" } } */
+/* { dg-final { scan-tree-dump-times "Eliminated tail recursion" 2 "tailr1"} } */
+/* { dg-final { cleanup-tree-dump "tailr1" } } */
index 201f8ee5a00f5785fcce0dfb1f4f09ab9dc343de..7b8b61b44431366181b6cb6f799b5638da1b9b0c 100644 (file)
@@ -1,19 +1,29 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */
+
+
+inline int ten()
+{
+  return 10;
+}
+inline int zero()
+{
+  return 0;
+}
 
 foo (int k, int j)
 {
-  if (k >= 10)
+  if (k >= ten())
     {
       if (j > k)
        {
          /* We should fold this to if (1).  */
-         if (j > 0)
+         if (j > zero())
            return j;
        }
     }
 
-  return j;
+  return j+1;
 }
 
 /* { dg-final { scan-tree-dump-times "Folding predicate j_.*to 1" 1 "vrp1" } } */
index d21985626fa3557803eaba7518eebd684efd45f6..69e3e74d8097942a76693bcc6fcc5142120fcce4 100644 (file)
@@ -1,5 +1,11 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */
+
+int
+bounce (int arg)
+{
+  return arg;
+}
 
 foo (int k, int j, int z)
 {
@@ -8,13 +14,13 @@ foo (int k, int j, int z)
       if (j > k)
        {
          /* We should fold this to if (1).  */
-         if (j > z)
+         if (j > bounce (z))
            return j;
        }
     }
 
-  return j;
+  return j+1;
 }
 
-/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp1" } } */
+/* { dg-final { scan-tree-dump-times "Folding predicate.*to 1" 1 "vrp2" } } */
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
This page took 0.149611 seconds and 5 git commands to generate.