Commit 048bf48b by Jan Hubicka Committed by Jan Hubicka

tree-ssa-coalesce.c (coalesce_cost): Do not take ciritical parameter; update callers.

	* tree-ssa-coalesce.c (coalesce_cost): Do not take ciritical
	parameter; update callers.
	(coalesce_cost_edge): EH edges are costier because they needs splitting
	even if not critical and even more costier when there are multiple
	EH predecestors.

From-SVN: r147057
parent d5c5f9ab
2009-05-02 Jan Hubicka <jh@suse.cz> 2009-05-02 Jan Hubicka <jh@suse.cz>
* tree-ssa-coalesce.c (coalesce_cost): Do not take ciritical
parameter; update callers.
(coalesce_cost_edge): EH edges are costier because they needs splitting
even if not critical and even more costier when there are multiple
EH predecestors.
2009-05-02 Jan Hubicka <jh@suse.cz>
* except.c (remove_eh_handler_and_replace): Handle updating after * except.c (remove_eh_handler_and_replace): Handle updating after
removing TRY blocks. removing TRY blocks.
......
...@@ -71,11 +71,10 @@ typedef struct coalesce_list_d ...@@ -71,11 +71,10 @@ typedef struct coalesce_list_d
#define MUST_COALESCE_COST INT_MAX #define MUST_COALESCE_COST INT_MAX
/* Return cost of execution of copy instruction with FREQUENCY /* Return cost of execution of copy instruction with FREQUENCY. */
possibly on CRITICAL edge and in HOT basic block. */
static inline int static inline int
coalesce_cost (int frequency, bool optimize_for_size, bool critical) coalesce_cost (int frequency, bool optimize_for_size)
{ {
/* Base costs on BB frequencies bounded by 1. */ /* Base costs on BB frequencies bounded by 1. */
int cost = frequency; int cost = frequency;
...@@ -86,9 +85,6 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical) ...@@ -86,9 +85,6 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical)
if (optimize_for_size) if (optimize_for_size)
cost = 1; cost = 1;
/* Inserting copy on critical edge costs more than inserting it elsewhere. */
if (critical)
cost *= 2;
return cost; return cost;
} }
...@@ -98,7 +94,7 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical) ...@@ -98,7 +94,7 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical)
static inline int static inline int
coalesce_cost_bb (basic_block bb) coalesce_cost_bb (basic_block bb)
{ {
return coalesce_cost (bb->frequency, optimize_bb_for_size_p (bb), false); return coalesce_cost (bb->frequency, optimize_bb_for_size_p (bb));
} }
...@@ -107,12 +103,38 @@ coalesce_cost_bb (basic_block bb) ...@@ -107,12 +103,38 @@ coalesce_cost_bb (basic_block bb)
static inline int static inline int
coalesce_cost_edge (edge e) coalesce_cost_edge (edge e)
{ {
int mult = 1;
/* Inserting copy on critical edge costs more than inserting it elsewhere. */
if (EDGE_CRITICAL_P (e))
mult = 2;
if (e->flags & EDGE_ABNORMAL) if (e->flags & EDGE_ABNORMAL)
return MUST_COALESCE_COST; return MUST_COALESCE_COST;
if (e->flags & EDGE_EH)
{
edge e2;
edge_iterator ei;
FOR_EACH_EDGE (e2, ei, e->dest->preds)
if (e2 != e)
{
/* Putting code on EH edge that leads to BB
with multiple predecestors imply splitting of
edge too. */
if (mult < 2)
mult = 2;
/* If there are multiple EH predecestors, we
also copy EH regions and produce separate
landing pad. This is expensive. */
if (e2->flags & EDGE_EH)
{
mult = 5;
break;
}
}
}
return coalesce_cost (EDGE_FREQUENCY (e), return coalesce_cost (EDGE_FREQUENCY (e),
optimize_edge_for_size_p (e), optimize_edge_for_size_p (e)) * mult;
EDGE_CRITICAL_P (e));
} }
...@@ -1094,8 +1116,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy) ...@@ -1094,8 +1116,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
if (SSA_NAME_VAR (outputs[match]) == SSA_NAME_VAR (input)) if (SSA_NAME_VAR (outputs[match]) == SSA_NAME_VAR (input))
{ {
cost = coalesce_cost (REG_BR_PROB_BASE, cost = coalesce_cost (REG_BR_PROB_BASE,
optimize_bb_for_size_p (bb), optimize_bb_for_size_p (bb));
false);
add_coalesce (cl, v1, v2, cost); add_coalesce (cl, v1, v2, cost);
bitmap_set_bit (used_in_copy, v1); bitmap_set_bit (used_in_copy, v1);
bitmap_set_bit (used_in_copy, v2); bitmap_set_bit (used_in_copy, v2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment