On Wed, Dec 13, 2017 at 05:22:32AM -0200, Alexandre Oliva wrote:
> On Dec 12, 2017, Rainer Orth <[email protected]> wrote:
>
> > Hi David,
> >> Something in this series broke bootstrap on AIX, probably Power in general.
>
> > I'm seeing the same in a sparc-sun-solaris2.11 bootstrap.
>
> The AIX patch, that I've just emailed out in this thread, should fix
> that as well. As for the regression you reported, here's a fix.
> Regstrapping; ok to install?
>
>
> [SFN] don't assume BLOCK_FOR_INSN is set in var-tracking
>
> There's no guarantee that BLOCK_FOR_INSN will be set before var-tracking.
> So, keep track of whether we're in the first block header or inside a BB
> explicitly, and apply the logic we meant to apply outside BBs only when
> we are indeed outside a BB.
>
> for gcc/ChangeLog
>
> PR bootstrap/83396
> * var-tracking.c (vt_initialize): Keep track of BB boundaries.
This looks like a workaround for a bigger problem.
In particular, this testcase is using selective scheduling, therefore
we turn off -fvar-tracking-assignments, but the debug stmt markers are
emitted anyway.
-fvar-tracking is still true, so the var-tracking pass does everything it
normally does (successfully), then the free_cfg pass removes all
BLOCK_FOR_INSN notes, then some targets in their machine reorg recompute
those, but sparc apparently doesn't, and finally in final.c:
/* Turn debug markers into notes. */
if (!MAY_HAVE_DEBUG_BIND_INSNS && MAY_HAVE_DEBUG_MARKER_INSNS)
variable_tracking_main ();
Eeek, this runs all of the var tracking again, even when it has been done
earlier, but this time without BLOCK_FOR_INSN.
This is just wrong. So, I think the right fix here is instead (so far
tested just with sparc cross-compiler on the single testcase).
Or export delete_vta_debug_insns function and call that under that condition
instead of variable_tracking_main, which will do the same thing for
!flag_var_tracking.
2017-12-13 Jakub Jelinek <[email protected]>
PR bootstrap/83396
* final.c (rest_of_handle_final): Call variable_tracking_main only
if !flag_var_tracking.
--- gcc/final.c.jj 2017-12-12 09:48:15.000000000 +0100
+++ gcc/final.c 2017-12-13 11:29:12.284676265 +0100
@@ -4541,8 +4541,9 @@ rest_of_handle_final (void)
{
const char *fnname = get_fnname_from_decl (current_function_decl);
- /* Turn debug markers into notes. */
- if (!MAY_HAVE_DEBUG_BIND_INSNS && MAY_HAVE_DEBUG_MARKER_INSNS)
+ /* Turn debug markers into notes if the var-tracking pass has not
+ been invoked. */
+ if (!flag_var_tracking && MAY_HAVE_DEBUG_MARKER_INSNS)
variable_tracking_main ();
assemble_start_function (current_function_decl, fnname);
Jakub