diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2007-03-09 20:13:10 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2007-03-09 20:13:10 +0000 |
commit | 7e7e28c7c7cf19bd9cfdd2387d3d3b61fd3cf31b (patch) | |
tree | 709013022c7b1d9984a66229cbe7d5f71cc86b89 /gcc/cse.c | |
parent | a009aafece33ccff7dffb66ba0f1c8466e97b1f6 (diff) | |
download | gcc-7e7e28c7c7cf19bd9cfdd2387d3d3b61fd3cf31b.zip gcc-7e7e28c7c7cf19bd9cfdd2387d3d3b61fd3cf31b.tar.gz gcc-7e7e28c7c7cf19bd9cfdd2387d3d3b61fd3cf31b.tar.bz2 |
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
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 38 |
1 files changed, 34 insertions, 4 deletions
@@ -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); } |