OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree-stdarg.c
index 7f16092..9b7a126 100644 (file)
@@ -1,5 +1,5 @@
 /* Pass computing data for optimizing stdarg functions.
-   Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010
+   Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Jakub Jelinek <jakub@redhat.com>
 
@@ -627,7 +627,8 @@ check_all_va_list_escapes (struct stdarg_info *si)
 static bool
 gate_optimize_stdarg (void)
 {
-  return true;
+  /* This optimization is only for stdarg functions.  */
+  return cfun->stdarg != 0;
 }
 
 
@@ -644,10 +645,6 @@ execute_optimize_stdarg (void)
   const char *funcname = NULL;
   tree cfun_va_list;
 
-  /* This optimization is only for stdarg functions.  */
-  if (cfun->stdarg == 0)
-    return 0;
-
   cfun->va_list_gpr_size = 0;
   cfun->va_list_fpr_size = 0;
   memset (&si, 0, sizeof (si));
@@ -850,8 +847,12 @@ execute_optimize_stdarg (void)
                  if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
                      == GIMPLE_SINGLE_RHS)
                    {
+                     /* Check for ap ={v} {}.  */
+                     if (TREE_CLOBBER_P (rhs))
+                       continue;
+
                      /* Check for tem = ap.  */
-                     if (va_list_ptr_read (&si, rhs, lhs))
+                     else if (va_list_ptr_read (&si, rhs, lhs))
                        continue;
 
                      /* Check for the last insn in:
@@ -875,8 +876,12 @@ execute_optimize_stdarg (void)
                  if (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
                      == GIMPLE_SINGLE_RHS)
                    {
+                     /* Check for ap ={v} {}.  */
+                     if (TREE_CLOBBER_P (rhs))
+                       continue;
+
                      /* Check for ap[0].field = temp.  */
-                     if (va_list_counter_struct_op (&si, lhs, rhs, true))
+                     else if (va_list_counter_struct_op (&si, lhs, rhs, true))
                        continue;
 
                      /* Check for temp = ap[0].field.  */
@@ -966,6 +971,6 @@ struct gimple_opt_pass pass_stdarg =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  TODO_dump_func                       /* todo_flags_finish */
+  0                                    /* todo_flags_finish */
  }
 };