This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [rtlopt] fix bootstrap error
> > > Hi,
> > > bootstrap dies because bb-reorder creates chain not starting in basic
> > > block 0.
> > >
> > > diff -c -3 -p -r1.50.2.2 bb-reorder.c
> > > *** bb-reorder.c 21 Nov 2002 23:59:38 -0000 1.50.2.2
> > > --- bb-reorder.c 22 Nov 2002 12:15:14 -0000
> > > *************** connect_traces (n_traces, traces)
> > > *** 659,692 ****
> > > connected[t] = true;
> > >
> > > /* Find the predecessor traces. */
> > > ! for (t2 = t; t2 >= 0;)
> >
> > Oops, there should have been " for (t2 = t; t2 > 0;) "
>
> With your fix there is still one problem, for example:
> lets consider we are in trace 2 and we reorder trace 0 before trace 2
> and also trace 1 before trace 0.
> The chain now does not start in basic block 0.
>
> So the correct fix is
> for (t2 = t; t2 > 0;)
> instead of
> if (t)
> for (t2 = t; t2 >= 0;)
Commited, thanks!
Honza
>
> Josef
>
>
> Index: gcc/bb-reorder.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
> retrieving revision 1.50.2.3
> diff -c -3 -p -r1.50.2.3 bb-reorder.c
> *** gcc/bb-reorder.c 22 Nov 2002 12:19:04 -0000 1.50.2.3
> --- gcc/bb-reorder.c 22 Nov 2002 13:16:52 -0000
> *************** connect_traces (n_traces, traces)
> *** 659,693 ****
> connected[t] = true;
>
> /* Find the predecessor traces. */
> ! if (t)
> ! for (t2 = t; t2 >= 0;)
> ! {
> ! best = NULL;
> ! for (e = traces[t2].first->pred; e; e = e->pred_next)
> ! {
> ! if (e->src != ENTRY_BLOCK_PTR
> ! && (e->flags & EDGE_CAN_FALLTHRU)
> ! && !(e->flags & EDGE_COMPLEX)
> ! && e->src->index < original_last_basic_block
> ! && end_of_trace[e->src->index] >= 0
> ! && !connected[end_of_trace[e->src->index]]
> ! && (!best || e->probability > best->probability))
> ! best = e;
> ! }
> ! if (best)
> ! {
> ! RBI (best->src)->next = best->dest;
> ! t2 = end_of_trace[best->src->index];
> ! connected[t2] = true;
> ! if (rtl_dump_file)
> ! {
> ! fprintf (rtl_dump_file, "Connection: %d %d\n",
> ! best->src->index, best->dest->index);
> ! }
> ! }
> ! else
> ! break;
> ! }
>
> if (last_trace >= 0)
> RBI (traces[last_trace].last)->next = traces[t2].first;
> --- 659,692 ----
> connected[t] = true;
>
> /* Find the predecessor traces. */
> ! for (t2 = t; t2 > 0;)
> ! {
> ! best = NULL;
> ! for (e = traces[t2].first->pred; e; e = e->pred_next)
> ! {
> ! if (e->src != ENTRY_BLOCK_PTR
> ! && (e->flags & EDGE_CAN_FALLTHRU)
> ! && !(e->flags & EDGE_COMPLEX)
> ! && e->src->index < original_last_basic_block
> ! && end_of_trace[e->src->index] >= 0
> ! && !connected[end_of_trace[e->src->index]]
> ! && (!best || e->probability > best->probability))
> ! best = e;
> ! }
> ! if (best)
> ! {
> ! RBI (best->src)->next = best->dest;
> ! t2 = end_of_trace[best->src->index];
> ! connected[t2] = true;
> ! if (rtl_dump_file)
> ! {
> ! fprintf (rtl_dump_file, "Connection: %d %d\n",
> ! best->src->index, best->dest->index);
> ! }
> ! }
> ! else
> ! break;
> ! }
>
> if (last_trace >= 0)
> RBI (traces[last_trace].last)->next = traces[t2].first;