X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Ftailrec.c;h=28ab28faabb9ae8af4951320cc18a66db32b524d;hb=1268a295e95b532b46e2aed04505d5206181afda;hp=61ea98b32e46fb33f3a4f5b722420c7699c1e7ee;hpb=4b734653b3f11a3182963369bb58980e4d5a62cb;p=libfirm diff --git a/ir/opt/tailrec.c b/ir/opt/tailrec.c index 61ea98b32..28ab28faa 100644 --- a/ir/opt/tailrec.c +++ b/ir/opt/tailrec.c @@ -417,23 +417,24 @@ static void do_opt_tail_rec(ir_graph *irg, tr_env *env) { * @return non-zero if it's ok to do tail recursion */ static int check_lifetime_of_locals(ir_graph *irg) { - ir_node *irg_frame, *irg_val_param_base; + ir_node *irg_frame; int i; + ir_type *frame_tp = get_irg_frame_type(irg); irg_frame = get_irg_frame(irg); for (i = get_irn_n_outs(irg_frame) - 1; i >= 0; --i) { ir_node *succ = get_irn_out(irg_frame, i); - if (is_Sel(succ) && is_address_taken(succ)) - return 0; - } - - /* Check if we have compound arguments. - For now, we cannot handle them, */ - irg_val_param_base = get_irg_value_param_base(irg); - if (get_irn_n_outs(irg_val_param_base) > 0) - return 0; + if (is_Sel(succ)) { + /* Check if we have compound arguments. + For now, we cannot handle them, */ + if (get_entity_owner(get_Sel_entity(succ)) != frame_tp) + return 0; + if (is_address_taken(succ)) + return 0; + } + } return 1; }