summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 22:07:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 22:07:45 +0000
commit24d874321b88ab66691a4c75c568106be1e91af5 (patch)
tree1b4bc9c9cb931afa6b95c9587f431f9506d34657
parent188fc74c700cec58eb6d341fd8802c6deff2dfca (diff)
downloadgcc-24d874321b88ab66691a4c75c568106be1e91af5.tar.gz
PR optimization/6759
* cse.c (cse_insn): Fold src_eqv just once, store it folded back into the REQ_EQUAL note. * g++.dg/opt/cse1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54469 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cse.c6
-rw-r--r--gcc/testsuite/ChangeLog2
-rw-r--r--gcc/testsuite/g++.dg/opt/cse1.C12
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f92ef9b762c..8b6464a3320 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2002-06-10 Jakub Jelinek <jakub@redhat.com>
+ PR optimization/6759
+ * cse.c (cse_insn): Fold src_eqv just once, store it folded back into
+ the REQ_EQUAL note.
+
+2002-06-10 Jakub Jelinek <jakub@redhat.com>
+
PR c/6660
* c-decl.c (grokfield): Allow user defined types if they declare
structs or unions for unnamed fields.
diff --git a/gcc/cse.c b/gcc/cse.c
index 0b91d99d448..01a79d5c978 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4915,7 +4915,10 @@ cse_insn (insn, libcall_insn)
&& (tem = find_reg_note (insn, REG_EQUAL, NULL_RTX)) != 0
&& (! rtx_equal_p (XEXP (tem, 0), SET_SRC (sets[0].rtl))
|| GET_CODE (SET_DEST (sets[0].rtl)) == STRICT_LOW_PART))
- src_eqv = canon_reg (XEXP (tem, 0), NULL_RTX);
+ {
+ src_eqv = fold_rtx (canon_reg (XEXP (tem, 0), NULL_RTX), insn);
+ XEXP (tem, 0) = src_eqv;
+ }
/* Canonicalize sources and addresses of destinations.
We do this in a separate pass to avoid problems when a MATCH_DUP is
@@ -5019,7 +5022,6 @@ cse_insn (insn, libcall_insn)
eqvmode = GET_MODE (SUBREG_REG (XEXP (dest, 0)));
do_not_record = 0;
hash_arg_in_memory = 0;
- src_eqv = fold_rtx (src_eqv, insn);
src_eqv_hash = HASH (src_eqv, eqvmode);
/* Find the equivalence class for the equivalent expression. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1d8229c615e..d2c3fbd9f54 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -10,6 +10,8 @@
* gcc.dg/20020527-1.c: New test.
+ * g++.dg/opt/cse1.C: New test.
+
2002-06-07 Roger Sayle <roger@eyesopen.com>
* gcc.dg/20020607-2.c: New test case.
diff --git a/gcc/testsuite/g++.dg/opt/cse1.C b/gcc/testsuite/g++.dg/opt/cse1.C
new file mode 100644
index 00000000000..be1ad5a1143
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/cse1.C
@@ -0,0 +1,12 @@
+// PR optimization/6759
+// This testcase ICEd on SPARC because folded REG_EQUAL
+// note was note stored back and fold_rtx left invalid rtx
+// in it.
+// { dg-do compile }
+// { dg-options "-O2" }
+
+struct A
+{
+ long long a;
+ A (unsigned short d) : a (d) {}
+} x (65535);