This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Gimplifying Java
On Thu, 2003-06-12 at 17:21, Andrew MacLeod wrote:
> On Thu, 2003-06-12 at 17:14, Jeff Sturm wrote:
>
> I guess the general rule would probably be that an edge needs to be
> split if the src block has more than 1 *normal* edge, or the dest block
> has more than 1 *normal* predecessor.
>
> Right now it just counts edges. The edge from 9 to 10 is marked abnormal
> right? so I can simple insert right at the end of block 9.
>
> Let me try to handle that right now.. hold on..
Try this. Im running tests right now, so I dont know if it introduces
new failures or not, but I did notice it fixed one C++ testcase :-)
(FAIL: g++.dg/eh/cleanup1.C works with this patch :-)
TRy it an see if it helps.
Andrew
* tree-cfg.c (bsi_commit_first_edge_insert): Only consider non-abnormal
edges when determining whether an edge needs to be split.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.105
diff -c -p -r1.1.4.105 tree-cfg.c
*** tree-cfg.c 12 Jun 2003 04:36:20 -0000 1.1.4.105
--- tree-cfg.c 12 Jun 2003 21:27:00 -0000
*************** bsi_commit_first_edge_insert (edge e, tr
*** 3824,3845 ****
basic_block src, dest, new_bb;
block_stmt_iterator bsi, tmp;
tree_stmt_iterator tsi;
! int single_exit, single_entry;
enum find_location_action location;
tree first, last, inserted_stmt, parent;
bb_ann_t ann;
first = last = NULL_TREE;
src = e->src;
dest = e->dest;
! single_exit = (src->succ->succ_next == NULL);
! single_entry = (dest->pred->pred_next == NULL);
/* If it is a single exit block, and it isn't the entry block, and the edge
is not abnormal, then insert at the end of the block, if we can. */
! if (single_exit
&& src != ENTRY_BLOCK_PTR
&& ((e->flags & EDGE_ABNORMAL)) == 0)
{
--- 3824,3852 ----
basic_block src, dest, new_bb;
block_stmt_iterator bsi, tmp;
tree_stmt_iterator tsi;
! int num_exit, num_entry;
enum find_location_action location;
tree first, last, inserted_stmt, parent;
bb_ann_t ann;
+ edge e2;
first = last = NULL_TREE;
src = e->src;
dest = e->dest;
! num_exit = num_entry = 0;
! for (e2 = src->succ; e2; e2 = e2->succ_next)
! if (!(e->flags & EDGE_ABNORMAL))
! num_exit++;
!
! for (e2 = src->pred; e2; e2 = e2->pred_next)
! if (!(e->flags & EDGE_ABNORMAL))
! num_entry++;
/* If it is a single exit block, and it isn't the entry block, and the edge
is not abnormal, then insert at the end of the block, if we can. */
! if (num_exit == 1
&& src != ENTRY_BLOCK_PTR
&& ((e->flags & EDGE_ABNORMAL)) == 0)
{
*************** bsi_commit_first_edge_insert (edge e, tr
*** 3875,3881 ****
/* If it is a single entry destination, and it isn't the exit block, the new
stmt can be inserted at the beginning of the destination block. */
! if (single_entry && dest != EXIT_BLOCK_PTR)
{
bsi = bsi_start (dest);
/* If it is an empty block, simply insert after this bsi, and the new stmt
--- 3882,3888 ----
/* If it is a single entry destination, and it isn't the exit block, the new
stmt can be inserted at the beginning of the destination block. */
! if (num_entry == 1 && dest != EXIT_BLOCK_PTR)
{
bsi = bsi_start (dest);
/* If it is an empty block, simply insert after this bsi, and the new stmt