This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Partly revert my previous cfg-layout change
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, gcc-pdo at atrey dot karlin dot mff dot cuni dot cz
- Date: Sun, 12 May 2002 14:10:17 +0200
- Subject: Partly revert my previous cfg-layout change
Hi,
my previous cfglayout change (to allow duplicating and reordering of last bb in
fuction) has opened an cam of worms. Reload and reorg expects the
USEs/CLOBBERs of returnted value we produce in the last BB to be in the last
that is no longer true. Aditionally cfglayout now ocassionally remove them
during BB forwarding after reloading confusing liveness analysis. I would like
to fix this properly after finals, but right now I don't have time for, thus:
I am installing the patch for cfg-branch, bootstrapped i386 on mainline,
OK for mainline?
Sun May 12 15:18:53 CEST 2002 Jan Hubicka <jh@suse.cz>
* cfglayout.c: Partly revert previous patch due to reload/reorg
problems.
(fixup_fallthru_exit_predecessor): Renew.
(cfg_layout_initialize): Use it.
(cfg_layout_can_duplicate_bb_p): Again prohibit edges to exit.
*** cfglayout.c.o Sun May 12 15:03:36 2002
--- cfglayout.c Sun May 12 15:18:46 2002
*************** static void set_block_levels PARAMS ((t
*** 46,51 ****
--- 46,52 ----
static void change_scope PARAMS ((rtx, tree, tree));
void verify_insn_chain PARAMS ((void));
+ static void fixup_fallthru_exit_predecessor PARAMS ((void));
static void cleanup_unconditional_jumps PARAMS ((struct loops *));
static rtx unlink_insn_chain PARAMS ((rtx, rtx));
static rtx duplicate_insn_chain PARAMS ((rtx, rtx));
*************** cleanup_unconditional_jumps (loops)
*** 692,697 ****
--- 693,725 ----
}
}
+ /* The block falling through to exit must be the last one in the
+ reordered chain. Ensure that this condition is met. */
+ static void
+ fixup_fallthru_exit_predecessor ()
+ {
+ edge e;
+ basic_block bb = NULL;
+
+ for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
+ if (e->flags & EDGE_FALLTHRU)
+ bb = e->src;
+
+ if (bb && RBI (bb)->next)
+ {
+ basic_block c = BASIC_BLOCK (0);
+
+ while (RBI (c)->next != bb)
+ c = RBI (c)->next;
+
+ RBI (c)->next = RBI (bb)->next;
+ while (RBI (c)->next)
+ c = RBI (c)->next;
+
+ RBI (c)->next = bb;
+ RBI (bb)->next = NULL;
+ }
+ }
/* Return true in case it is possible to duplicate the basic block BB. */
*************** cfg_layout_can_duplicate_bb_p (bb)
*** 700,709 ****
--- 728,744 ----
basic_block bb;
{
rtx next;
+ edge s;
if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR)
return false;
+ /* Duplicating fallthru block to exit would require adding an jump
+ and splitting the real last BB. */
+ for (s = bb->succ; s; s = s->succ_next)
+ if (s->dest == EXIT_BLOCK_PTR && (s->flags & EDGE_FALLTHRU))
+ return false;
+
/* Do not attempt to duplicate tablejumps, as we need to unshare
the dispatch table. This is dificult to do, as the instructions
computing jump destination may be hoisted outside the basic block. */
*************** cfg_layout_initialize (loops)
*** 968,973 ****
--- 1003,1009 ----
void
cfg_layout_finalize ()
{
+ fixup_fallthru_exit_predecessor ();
fixup_reorder_chain ();
#ifdef ENABLE_CHECKING