re PR rtl-optimization/6759 (ice when compiling 32 bit sparc code)

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.

From-SVN: r54469
This commit is contained in:
Jakub Jelinek 2002-06-11 00:07:45 +02:00 committed by Jakub Jelinek
parent 85d490584b
commit 7b668f9ed0
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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. */

View File

@ -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.

View File

@ -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);