[pretty-ipa] EH moves are free
Jan Hubicka
hubicka@ucw.cz
Sun Mar 29 12:31:00 GMT 2009
Hi,
for every EH receiver we emit load from FILTER_EXPR and EXC_PTR_EXPR
and immediate store into it to handle nested exceptions. Because there
are usually none and the values are in register, they will most likely
be optimized out after lowering.
Setting them to cost of 0 is safe because we are dominated by
the function call doing EH itself or cleanup code.
Honza
Index: tree-inline.c
===================================================================
*** tree-inline.c (revision 145226)
--- tree-inline.c (working copy)
*************** estimate_num_insns (gimple stmt, eni_wei
*** 3488,3499 ****
of moving something into "a", which we compute using the function
estimate_move_cost. */
lhs = gimple_assign_lhs (stmt);
if (is_gimple_reg (lhs))
cost = 0;
else
cost = estimate_move_cost (TREE_TYPE (lhs));
- rhs = gimple_assign_rhs1 (stmt);
if (!is_gimple_reg (rhs) && !is_gimple_min_invariant (rhs))
cost += estimate_move_cost (TREE_TYPE (rhs));
--- 3488,3508 ----
of moving something into "a", which we compute using the function
estimate_move_cost. */
lhs = gimple_assign_lhs (stmt);
+ rhs = gimple_assign_rhs1 (stmt);
+
+ /* EH magic stuff is most probably going to be optimized out.
+ We rarely really need to save EH info for unwinding
+ nested exceptions. */
+ if (TREE_CODE (lhs) == FILTER_EXPR
+ || TREE_CODE (lhs) == EXC_PTR_EXPR
+ || TREE_CODE (rhs) == FILTER_EXPR
+ || TREE_CODE (rhs) == EXC_PTR_EXPR)
+ return 0;
if (is_gimple_reg (lhs))
cost = 0;
else
cost = estimate_move_cost (TREE_TYPE (lhs));
if (!is_gimple_reg (rhs) && !is_gimple_min_invariant (rhs))
cost += estimate_move_cost (TREE_TYPE (rhs));
More information about the Gcc-patches
mailing list