OSDN Git Service

2010-04-16 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Apr 2010 13:21:38 +0000 (13:21 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:33:09 +0000 (14:33 +0900)
PR tree-optimization/43572
* tree-ssa-alias.h (call_may_clobber_ref_p): Declare.
* tree-ssa-alias.c (call_may_clobber_ref_p): Export.
* tree-flow.h (is_call_clobbered): Remove.
* tree-flow-inline.h (is_call_clobbered): Likewise.
* tree-dfa.c (dump_variable): Do not dump call clobber state.
* tree-nrv.c (dest_safe_for_nrv_p): Use the alias oracle.
(execute_return_slot_opt): Adjust.
* tree-tailcall.c (suitable_for_tail_opt_p): Remove
check for call clobbered vars here.
(find_tail_calls): Move tailcall verification to the
proper place.

* gcc.dg/tree-ssa/tailcall-5.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158418 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-dfa.c
gcc/tree-flow-inline.h
gcc/tree-nrv.c
gcc/tree-tailcall.c

index 15cddb8..68242ae 100644 (file)
@@ -1,3 +1,18 @@
+2010-04-16  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/43572
+       * tree-ssa-alias.h (call_may_clobber_ref_p): Declare.
+       * tree-ssa-alias.c (call_may_clobber_ref_p): Export.
+       * tree-flow.h (is_call_clobbered): Remove.
+       * tree-flow-inline.h (is_call_clobbered): Likewise.
+       * tree-dfa.c (dump_variable): Do not dump call clobber state.
+       * tree-nrv.c (dest_safe_for_nrv_p): Use the alias oracle.
+       (execute_return_slot_opt): Adjust.
+       * tree-tailcall.c (suitable_for_tail_opt_p): Remove
+       check for call clobbered vars here.
+       (find_tail_calls): Move tailcall verification to the
+       proper place.
+
 2010-04-16  Diego Novillo  <dnovillo@google.com>
 
        * doc/invoke.texi: Explain how are unrecognized -Wno- warnings
index 4885f6c..d70869a 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-16  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/43572
+       * gcc.dg/tree-ssa/tailcall-5.c: New testcase.
+
 2010-04-16  Olivier Hainque  <hainque@adacore.com>
 
        * gnat.dg/specs/discr_private.ads: New test.
index 5f9262f..d5a56e5 100644 (file)
@@ -280,9 +280,6 @@ dump_variable (FILE *file, tree var)
   if (TREE_THIS_VOLATILE (var))
     fprintf (file, ", is volatile");
 
-  if (is_call_clobbered (var))
-    fprintf (file, ", call clobbered");
-
   if (ann && ann->noalias_state == NO_ALIAS)
     fprintf (file, ", NO_ALIAS (does not alias other NO_ALIAS symbols)");
   else if (ann && ann->noalias_state == NO_ALIAS_GLOBAL)
index 2430f03..f7609ea 100644 (file)
@@ -624,15 +624,6 @@ loop_containing_stmt (gimple stmt)
 }
 
 
-/* Return true if VAR is clobbered by function calls.  */
-static inline bool
-is_call_clobbered (const_tree var)
-{
-  return (is_global_var (var)
-         || (may_be_aliased (var)
-             && pt_solution_includes (&cfun->gimple_df->escaped, var)));
-}
-
 /*  -----------------------------------------------------------------------  */
 
 /* The following set of routines are used to iterator over various type of
index 1844002..c2e49d3 100644 (file)
@@ -305,7 +305,7 @@ dest_safe_for_nrv_p (gimple call)
   if (TREE_CODE (dest) == SSA_NAME)
     return true;
 
-  if (is_call_clobbered (dest))
+  if (call_may_clobber_ref_p (call, dest))
     return false;
 
   return true;
index 969e07d..989ae2c 100644 (file)
@@ -133,26 +133,6 @@ suitable_for_tail_opt_p (void)
   if (cfun->stdarg)
     return false;
 
-  /* No local variable nor structure field should escape to callees.  */
-  FOR_EACH_REFERENCED_VAR (var, rvi)
-    {
-      if (!is_global_var (var)
-         /* ???  We do not have a suitable predicate for escaping to
-            callees.  With IPA-PTA the following might be incorrect.
-            We want to catch
-              foo {
-                int i;
-                bar (&i);
-                foo ();
-              }
-            where bar might store &i somewhere and in the next
-            recursion should not be able to tell if it got the
-            same (with tail-recursion applied) or a different
-            address.  */
-         && is_call_clobbered (var))
-       return false;
-    }
-
   return true;
 }
 /* Returns false when the function is not suitable for tail call optimization
@@ -441,8 +421,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
   func = gimple_call_fndecl (call);
   if (func == current_function_decl)
     {
-      tree arg, var;
-      referenced_var_iterator rvi;
+      tree arg;
 
       for (param = DECL_ARGUMENTS (func), idx = 0;
           param && idx < gimple_call_num_args (call);
@@ -473,15 +452,15 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
        }
       if (idx == gimple_call_num_args (call) && !param)
        tail_recursion = true;
+    }
 
-      /* Make sure the tail invocation of this function does not refer
-        to local variables.  */
-      FOR_EACH_REFERENCED_VAR (var, rvi)
-       {
-         if (!is_global_var (var)
-             && ref_maybe_used_by_stmt_p (call, var))
-           return;
-       }
+  /* Make sure the tail invocation of this function does not refer
+     to local variables.  */
+  FOR_EACH_REFERENCED_VAR (var, rvi)
+    {
+      if (!is_global_var (var)
+         && ref_maybe_used_by_stmt_p (call, var))
+       return;
     }
 
   /* Make sure the tail invocation of this function does not refer