This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for cse: -g -O should generate same code as -O
- To: egcs-patches at cygnus dot com
- Subject: PATCH for cse: -g -O should generate same code as -O
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Wed, 17 Jun 1998 16:43:14 -0700
- Cc: Jeff Law <law at cygnus dot com>
- Reply-to: mark at markmitchell dot com
I was rather disturbed to find a test case that produced different
output when using -g -O instead of just -O.
Here's a fix.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
Wed Jun 17 16:38:57 1998 Mark Mitchell <mark@markmitchell.com>
* cse.c (cse_basic_block): Don't include NOTE insns in the count
that is used to decide whether or not it is time to erase the
equivalence table.
Index: cse.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cse.c,v
retrieving revision 1.34
diff -c -p -r1.34 cse.c
*** cse.c 1998/06/08 18:30:13 1.34
--- cse.c 1998/06/17 23:37:33
*************** cse_basic_block (from, to, next_branch,
*** 8507,8522 ****
for (insn = from; insn != to; insn = NEXT_INSN (insn))
{
! register enum rtx_code code;
int i;
struct table_elt *p, *next;
! /* If we have processed 1,000 insns, flush the hash table to avoid
! extreme quadratic behavior.
??? This is a real kludge and needs to be done some other way.
Perhaps for 2.9. */
! if (num_insns++ > 1000)
{
for (i = 0; i < NBUCKETS; i++)
for (p = table[i]; p; p = next)
--- 8507,8526 ----
for (insn = from; insn != to; insn = NEXT_INSN (insn))
{
! register enum rtx_code code = GET_CODE (insn);
int i;
struct table_elt *p, *next;
! /* If we have processed 1,000 insns, flush the hash table to
! avoid extreme quadratic behavior. We must not include NOTEs
! in the count since there may be more or them when generating
! debugging information. If we clear the table at different
! times, code generated with -g -O might be different than code
! generated with -O but not -g.
??? This is a real kludge and needs to be done some other way.
Perhaps for 2.9. */
! if (code != NOTE && num_insns++ > 1000)
{
for (i = 0; i < NBUCKETS; i++)
for (p = table[i]; p; p = next)
*************** cse_basic_block (from, to, next_branch,
*** 8555,8561 ****
}
}
- code = GET_CODE (insn);
if (GET_MODE (insn) == QImode)
PUT_MODE (insn, VOIDmode);
--- 8559,8564 ----