mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-05 13:51:00 +08:00
re PR rtl-optimization/30643 (CSE pessimization)
gcc/ChangeLog: PR rtl-optimization/30643 * cse.c (cse_insn): Recompute dest_hash after insert_regs for (fold_rtx): Recurse, like before 2006-11-03. gcc/testsuite/ChangeLog: PR rtl-optimization/30643 * gcc.dg/pr30643.c: New. From-SVN: r122760
This commit is contained in:
parent
a009aafece
commit
7e7e28c7c7
@ -1,3 +1,9 @@
|
||||
2007-03-09 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR rtl-optimization/30643
|
||||
* cse.c (cse_insn): Recompute dest_hash after insert_regs for
|
||||
(fold_rtx): Recurse, like before 2006-11-03.
|
||||
|
||||
2007-03-09 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* config/m32c/t-m32c (m32c-pragma.o): Add TM_H dependency to m32c-pragma.o
|
||||
|
38
gcc/cse.c
38
gcc/cse.c
@ -1,6 +1,7 @@
|
||||
/* Common subexpression elimination for GNU compiler.
|
||||
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998
|
||||
1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
@ -3045,11 +3046,37 @@ fold_rtx (rtx x, rtx insn)
|
||||
{
|
||||
rtx folded_arg = XEXP (x, i), const_arg;
|
||||
enum machine_mode mode_arg = GET_MODE (folded_arg);
|
||||
|
||||
switch (GET_CODE (folded_arg))
|
||||
{
|
||||
case MEM:
|
||||
case REG:
|
||||
case SUBREG:
|
||||
const_arg = equiv_constant (folded_arg);
|
||||
break;
|
||||
|
||||
case CONST:
|
||||
case CONST_INT:
|
||||
case SYMBOL_REF:
|
||||
case LABEL_REF:
|
||||
case CONST_DOUBLE:
|
||||
case CONST_VECTOR:
|
||||
const_arg = folded_arg;
|
||||
break;
|
||||
|
||||
#ifdef HAVE_cc0
|
||||
if (CC0_P (folded_arg))
|
||||
folded_arg = prev_insn_cc0, mode_arg = prev_insn_cc0_mode;
|
||||
case CC0:
|
||||
folded_arg = prev_insn_cc0;
|
||||
mode_arg = prev_insn_cc0_mode;
|
||||
const_arg = equiv_constant (folded_arg);
|
||||
break;
|
||||
#endif
|
||||
const_arg = equiv_constant (folded_arg);
|
||||
|
||||
default:
|
||||
folded_arg = fold_rtx (folded_arg, insn);
|
||||
const_arg = equiv_constant (folded_arg);
|
||||
break;
|
||||
}
|
||||
|
||||
/* For the first three operands, see if the operand
|
||||
is constant or equivalent to a constant. */
|
||||
@ -5254,8 +5281,11 @@ cse_insn (rtx insn, rtx libcall_insn)
|
||||
{
|
||||
if (insert_regs (x, NULL, 0))
|
||||
{
|
||||
rtx dest = SET_DEST (sets[i].rtl);
|
||||
|
||||
rehash_using_reg (x);
|
||||
hash = HASH (x, mode);
|
||||
sets[i].dest_hash = HASH (dest, GET_MODE (dest));
|
||||
}
|
||||
elt = insert (x, NULL, hash, mode);
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-03-09 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR rtl-optimization/30643
|
||||
* gcc.dg/pr30643.c: New.
|
||||
|
||||
2007-03-09 Chao-ying Fu <fu@mips.com>
|
||||
|
||||
* gcc.target/mips/mips32-dspr2-type.c: New test.
|
||||
|
26
gcc/testsuite/gcc.dg/pr30643.c
Normal file
26
gcc/testsuite/gcc.dg/pr30643.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
/* { dg-final { scan-assembler-not "undefined" } } */
|
||||
|
||||
/* Make sure we optimize all calls away. */
|
||||
|
||||
extern void undefined (void);
|
||||
struct s { int a, b; };
|
||||
void bar (struct s *ps, int *p, int *__restrict__ rp, int *__restrict__ rq)
|
||||
{
|
||||
ps->a = 0;
|
||||
ps->b = 1;
|
||||
if (ps->a != 0)
|
||||
undefined ();
|
||||
p[0] = 0;
|
||||
p[1] = 1;
|
||||
if (p[0] != 0)
|
||||
undefined ();
|
||||
rp[0] = 0;
|
||||
rq[0] = 1;
|
||||
if (rp[0] != 0)
|
||||
undefined ();
|
||||
}
|
||||
int main (void) {
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user