This is the mail archive of the
mailing list for the GCC project.
Re: [patch] for PR 18601
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: rakdver at atrey dot karlin dot mff dot cuni dot cz
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 25 Nov 2004 01:26:40 -0500 (EST)
- Subject: Re: [patch] for PR 18601
- References: <20041125010046.GA5215@atrey.karlin.mff.cuni.cz>
> PR tree-optimization/18601
> * tree-cfg.c (thread_jumps, phi_alternatives_equal,
> thread_jumps_from_bb): Removed.
> (tree_forwarder_block_p): Do not consider blocks that are its own
> successors forwarders.
> (cleanup_forwarder_blocks, remove_forwarder_block): New functions.
> (cleanup_tree_cfg): Use cleanup_forwarder_blocks instead of
Wow, great! It's good that you are moving our focus to forwarder
blocks from non-forwarder blocks.
Without this patch, we focus on forwarder blocks while constructing
the worklist, but when it comes to draining the worklist, the focus
moves to non-forwarder blocks. At that point, we know we can thread
at least one outgoing edge out of each non-forwarder block in the
worklist, but it is probably often the case that none of the other
outgoing edges can be threaded, wasting a lot of time there.
With your patch, we know that all non-abnormal incoming edges to a
forwarder block can be threaded unless they are blocked by a PHI node.
> ! /* If there are phi nodes in DEST, and some of the blocks that are
> ! predecessors of BB are also predecessors of DEST, check that the
> ! phi node arguments match. Also record the list of arguments that
> ! come from SUCC edge, to avoid calling PHI_ARG_DEF_FROM_EDGE
> ! too much. */
> ! n = 0;
> ! for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
> ! n++;
> ! defs = xmalloc (n * sizeof (tree));
I don't know if this is necessary because, given an edge, you can now
look up a PHI argument in constant time, so you can copy PHI arguments
/* Create arguments for the phi nodes, since the edge was not
here before. */
for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
tree def = PHI_ARG_DEF (phi, succ->dest_idx);
add_phi_arg (&phi, def, s);
thereby avoiding malloc.