Message ID | alpine.LSU.2.11.1509011158410.5523@zhemvz.fhfr.qr |
---|---|
State | New |
Headers | show |
On Tue, Sep 01, 2015 at 12:09:48PM +0200, Richard Biener wrote: > > So I finally got around to dig into why some testcases I inspected for > early LTO debug (and some existing guality FAILs) happen. They happen > because we screw up locations of insns coming from TERed SSA defs > which end up using the TERed-into stmt location. So final re-building > the BLOCK tree ends up with no stmts in those BLOCKs and thus we > don't get any location annotations (even if the var location notes > are there). > > It looks like expand_expr_real_2 might have been designed to use > ops.location but in fact it only uses that when building other trees. For > singles we already adjust curr_insn_location, so the following does > that for all defs. > > This seems to explain the guality degradation over the years (we > just got better in coalescing / TERing...). > > In my dev tree this fixes all non-LTO, non-VLA guality FAILs, now > bootstrapping and testing on x86_64-unknown-linux-gnu. > > Note this patch can cause some extra jumping around between locations > in gdb - but that's expected I guess. It probably also causes some > debug-info growth. > > Ok for trunk if testing succeeds? Ok to backport? I'd say ok for trunk, wait some time before backport. > 2015-09-01 Richard Biener <rguenther@suse.de> > > * expr.c (expand_expr_real_1): For expanding TERed defs > set the current location to that of the def if not UNKNOWN. Jakub
Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 227360) +++ gcc/expr.c (working copy) @@ -9463,6 +9463,10 @@ expand_expr_real_1 (tree exp, rtx target if (g) { rtx r; + location_t saved_loc = curr_insn_location (); + location_t loc = gimple_location (g); + if (loc != UNKNOWN_LOCATION) + set_curr_insn_location (loc); ops.code = gimple_assign_rhs_code (g); switch (get_gimple_rhs_class (ops.code)) { @@ -9484,21 +9488,19 @@ expand_expr_real_1 (tree exp, rtx target case GIMPLE_UNARY_RHS: ops.op0 = gimple_assign_rhs1 (g); ops.type = TREE_TYPE (gimple_assign_lhs (g)); - ops.location = gimple_location (g); + ops.location = loc; r = expand_expr_real_2 (&ops, target, tmode, modifier); break; case GIMPLE_SINGLE_RHS: { - location_t saved_loc = curr_insn_location (); - set_curr_insn_location (gimple_location (g)); r = expand_expr_real (gimple_assign_rhs1 (g), target, tmode, modifier, NULL, inner_reference_p); - set_curr_insn_location (saved_loc); break; } default: gcc_unreachable (); } + set_curr_insn_location (saved_loc); if (REG_P (r) && !REG_EXPR (r)) set_reg_attrs_for_decl_rtl (SSA_NAME_VAR (exp), r); return r;