OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ipa-split.c
index 6195f81..061bafd 100644 (file)
@@ -1,5 +1,5 @@
 /* Function splitting pass
-   Copyright (C) 2010, 2011
+   Copyright (C) 2010, 2011, 2012
    Free Software Foundation, Inc.
    Contributed by Jan Hubicka  <jh@suse.cz>
 
@@ -624,7 +624,9 @@ find_return_bb (void)
   for (bsi = gsi_last_bb (e->src); !gsi_end_p (bsi); gsi_prev (&bsi))
     {
       gimple stmt = gsi_stmt (bsi);
-      if (gimple_code (stmt) == GIMPLE_LABEL || is_gimple_debug (stmt))
+      if (gimple_code (stmt) == GIMPLE_LABEL
+         || is_gimple_debug (stmt)
+         || gimple_clobber_p (stmt))
        ;
       else if (gimple_code (stmt) == GIMPLE_ASSIGN
               && found_return
@@ -657,7 +659,8 @@ find_retval (basic_block return_bb)
   for (bsi = gsi_start_bb (return_bb); !gsi_end_p (bsi); gsi_next (&bsi))
     if (gimple_code (gsi_stmt (bsi)) == GIMPLE_RETURN)
       return gimple_return_retval (gsi_stmt (bsi));
-    else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN)
+    else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
+            && !gimple_clobber_p (gsi_stmt (bsi)))
       return gimple_assign_rhs1 (gsi_stmt (bsi));
   return NULL;
 }
@@ -733,6 +736,9 @@ visit_bb (basic_block bb, basic_block return_bb,
       if (is_gimple_debug (stmt))
        continue;
 
+      if (gimple_clobber_p (stmt))
+       continue;
+
       /* FIXME: We can split regions containing EH.  We can not however
         split RESX, EH_DISPATCH and EH_POINTER referring to same region
         into different partitions.  This would require tracking of
@@ -1191,6 +1197,7 @@ split_function (struct split_point *split_point)
   /* Now create the actual clone.  */
   rebuild_cgraph_edges ();
   node = cgraph_function_versioning (cur_node, NULL, NULL, args_to_skip,
+                                    !split_part_return_p,
                                     split_point->split_bbs,
                                     split_point->entry_bb, "part");
   /* For usual cloning it is enough to clear builtin only when signature
@@ -1232,6 +1239,7 @@ split_function (struct split_point *split_point)
       }
   call = gimple_build_call_vec (node->decl, args_to_pass);
   gimple_set_block (call, DECL_INITIAL (current_function_decl));
+  VEC_free (tree, heap, args_to_pass);
 
   /* We avoid address being taken on any variable used by split part,
      so return slot optimization is always possible.  Moreover this is
@@ -1293,7 +1301,8 @@ split_function (struct split_point *split_point)
                            gimple_return_set_retval (gsi_stmt (bsi), retval);
                            break;
                          }
-                       else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN)
+                       else if (gimple_code (gsi_stmt (bsi)) == GIMPLE_ASSIGN
+                                && !gimple_clobber_p (gsi_stmt (bsi)))
                          {
                            gimple_assign_set_rhs1 (gsi_stmt (bsi), retval);
                            break;
@@ -1394,10 +1403,11 @@ execute_split_functions (void)
   int todo = 0;
   struct cgraph_node *node = cgraph_get_node (current_function_decl);
 
-  if (flags_from_decl_or_type (current_function_decl) & ECF_NORETURN)
+  if (flags_from_decl_or_type (current_function_decl)
+      & (ECF_NORETURN|ECF_MALLOC))
     {
       if (dump_file)
-       fprintf (dump_file, "Not splitting: noreturn function.\n");
+       fprintf (dump_file, "Not splitting: noreturn/malloc function.\n");
       return 0;
     }
   if (MAIN_NAME_P (DECL_NAME (current_function_decl)))