This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa]: Insertion at beginning of bb broken
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: 29 May 2003 18:25:50 -0400
- Subject: Re: [tree-ssa]: Insertion at beginning of bb broken
- References: <E8F2E250-9220-11D7-9E64-000A95A34564@dberlin.org>
On Thu, 2003-05-29 at 18:00, Daniel Berlin wrote:
> It no longer updates the bb head properly if you insert *before* the
> first statement of a bb.
>
> This is because it does:
> 3556 same_tsi = inserted_tsi;
> 3557 tsi_next (&same_tsi);
> 3558
> 3559 if (curr_container == curr_bb->head_tree_p)
> 3560 {
> 3561 curr_bb->head_tree_p = tsi_container (same_tsi);
>
> the structure after insertion, at line 3556, is like so:
>
> <compound_expr 0x190d940 <<<<<<<<<<<< NEW THING
> type <void_type 0x15477e0 void VOID
> align 8 symtab 0 alias set 21
> pointer_to_this <pointer_type 0x1547850>>
> side-effects
> arg 0 <modify_expr 0x190d900
> type <integer_type 0x1540540 long unsigned int unsigned SI
> size <integer_cst 0x153d578 constant 32>
> unit size <integer_cst 0x153d63c constant 4>
> align 32 symtab 0 alias set -1 precision 32 min
> <integer_cst 0x153d738 0> max <integer_cst 0x153d754 4294967295>>
> side-effects
> arg 0 <ssa_name 0x190d920 type <integer_type 0x1540540 long
> unsigned int>
> >
> arg 1 <minus_expr 0x190d8e0 type <integer_type 0x1540540 long
> unsigned int>
>
> arg 0 <ssa_name 0x1901040 type <integer_type 0x158f4d0
> size_t>
> >
> arg 1 <integer_cst 0x191b86c constant 1>>>
> arg 1 <compound_expr 0x18dc5e0 type <void_type 0x15477e0 void>
> <<<<<<<<<< OLD THING
> side-effects
> arg 0 <modify_expr 0x18dc600 type <integer_type 0x1540540 long
> unsigned int>
> side-effects
> arg 0 <ssa_name 0x1904a00 type <integer_type 0x1540540 long
> unsigned int>
> > arg 1 <ssa_name 0x190d920>
> ../../gcc/unwind-dw2-fde.c:548>
>
> inserted_tsi is a pointer to NEW THING.
> tsi_nexting moves it to OLD THING
> tsi_container (OLD THING) == OLD THING
> So we set the head to old thing, which is what it was already.
> This used to work right, and set the head to the new thing
> Can you please fix it?
> --Dan
>
So does this fix it for you?
Andrew
* tree-cfg.c (bsi_insert_before): Set BB head to new stmt container.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.96
diff -c -p -r1.1.4.96 tree-cfg.c
*** tree-cfg.c 24 May 2003 13:08:50 -0000 1.1.4.96
--- tree-cfg.c 29 May 2003 22:21:55 -0000
*************** bsi_insert_before (curr_bsi, t, mode)
*** 3558,3564 ****
if (curr_container == curr_bb->head_tree_p)
{
! curr_bb->head_tree_p = tsi_container (same_tsi);
/* If the parent block is a COND_EXPR or LOOP_EXPR, check if this
is the block which they point to and update if necessary. */
if (parent)
--- 3558,3564 ----
if (curr_container == curr_bb->head_tree_p)
{
! curr_bb->head_tree_p = tsi_container (inserted_tsi);
/* If the parent block is a COND_EXPR or LOOP_EXPR, check if this
is the block which they point to and update if necessary. */
if (parent)