This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/15654] [3.5 Regression] ICE in calculate_live_on_entry with -O2 -fno-tree-dominator-opts
- From: "rakdver at atrey dot karlin dot mff dot cuni dot cz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 May 2004 19:01:48 -0000
- Subject: [Bug tree-optimization/15654] [3.5 Regression] ICE in calculate_live_on_entry with -O2 -fno-tree-dominator-opts
- References: <20040525193217.15654.green@redhat.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz 2004-05-27 19:01 -------
Subject: Re: [3.5 Regression] ICE in calculate_live_on_entry with -O2 -fno-tree-dominator-opts
Hello,
> (In reply to comment #6)
> > The problem actually is in tailcall optimization, where we remove the call
> > that defines iCodeTop_8, but not the assigment iCodeTop_9 = iCodeTop_8
> > that follows it. I am testing the patch for the problem.
>
> Thanks to everyone who's helped with this bug!
>
> How's the testing going Zdenek?
the machine I tested it on crashed, so I am rerunning the tests. Here
is the patch, if someone wants to try it.
Zdenek
Index: tree-tailcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v
retrieving revision 2.3
diff -c -3 -p -r2.3 tree-tailcall.c
*** tree-tailcall.c 15 May 2004 09:39:29 -0000 2.3
--- tree-tailcall.c 26 May 2004 23:55:40 -0000
*************** eliminate_tail_call (struct tailcall *t)
*** 646,651 ****
--- 646,652 ----
stmt_ann_t ann;
vdef_optype vdefs;
unsigned i;
+ block_stmt_iterator bsi;
stmt = bsi_stmt (t->call_bsi);
get_stmt_operands (stmt);
*************** eliminate_tail_call (struct tailcall *t)
*** 665,670 ****
--- 666,686 ----
first = ENTRY_BLOCK_PTR->succ->dest;
+ /* Remove the code after call_bsi that will become unreachable. The
+ possibly unreachable code in other blocks is removed later in
+ cfg cleanup. */
+ bsi = t->call_bsi;
+ bsi_next (&bsi);
+ while (!bsi_end_p (bsi))
+ {
+ /* Do not remove the return statement, so that redirect_edge_and_branch
+ sees how the block ends. */
+ if (TREE_CODE (bsi_stmt (bsi)) == RETURN_EXPR)
+ break;
+
+ bsi_remove (&bsi);
+ }
+
/* Replace the call by a jump to the start of function. */
e = redirect_edge_and_branch (t->call_block->succ, first);
if (!e)
*************** eliminate_tail_call (struct tailcall *t)
*** 682,688 ****
param = TREE_CHAIN (param),
args = TREE_CHAIN (args))
{
-
for (phi = phi_nodes (first); phi; phi = TREE_CHAIN (phi))
if (param == SSA_NAME_VAR (PHI_RESULT (phi)))
break;
--- 698,703 ----
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15654