/* Function splitting pass
- Copyright (C) 2010, 2011
+ Copyright (C) 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>
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
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;
}
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
/* 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
}
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
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;
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)))