This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR 16590
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 29 Aug 2004 12:41:46 -0700
- Subject: PATCH: PR 16590
- Reply-to: mark at codesourcery dot com
This PR is a case where GCSE creates an invalid REG_EQUAL note. (More
details are in the audit trail.) I asked Jeff Law for his thoughts on
this patch about ten days ago, but haven't heard back, so I'm going
ahead and checking this in.
Tested on i686-pc-linux-gnu, applied on the 3.4 branch and on the
mainline.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2004-08-29 Mark Mitchell <mark@codesourcery.com>
PR rtl-optimization/16590
* gcse.c (pre_delete): Do not create invalid REG_EQUAL notes.
2004-08-29 Mark Mitchell <mark@codesourcery.com>
PR rtl-optimization/16590
* g++.dg/opt/loop1.C: New test.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.288.2.4
diff -c -5 -p -r1.288.2.4 gcse.c
*** gcse.c 25 Mar 2004 16:44:42 -0000 1.288.2.4
--- gcse.c 29 Aug 2004 19:29:16 -0000
*************** pre_delete (void)
*** 5680,5690 ****
the mode of the original destination pseudo. */
if (expr->reaching_reg == NULL)
expr->reaching_reg
= gen_reg_rtx (GET_MODE (SET_DEST (set)));
! gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
delete_insn (insn);
occr->deleted_p = 1;
SET_BIT (pre_redundant_insns, INSN_CUID (insn));
changed = 1;
gcse_subst_count++;
--- 5680,5692 ----
the mode of the original destination pseudo. */
if (expr->reaching_reg == NULL)
expr->reaching_reg
= gen_reg_rtx (GET_MODE (SET_DEST (set)));
! emit_insn_after (gen_move_insn (SET_DEST (set),
! expr->reaching_reg),
! insn);
delete_insn (insn);
occr->deleted_p = 1;
SET_BIT (pre_redundant_insns, INSN_CUID (insn));
changed = 1;
gcse_subst_count++;
Index: testsuite/g++.dg/opt/loop1.C
===================================================================
RCS file: testsuite/g++.dg/opt/loop1.C
diff -N testsuite/g++.dg/opt/loop1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/opt/loop1.C 29 Aug 2004 19:29:16 -0000
***************
*** 0 ****
--- 1,24 ----
+ // PR rtl-optimization/16590
+ // { dg-do run }
+ // { dg-options "-O2" }
+
+ extern "C" void abort();
+
+ struct iterator {
+ char * p;
+ int *dummy;
+ };
+
+ static iterator pend(char * start) {
+ iterator p = {start, 0};
+ if (p.p == start) p.p = start+5;
+ --p.p;
+ return p;
+ }
+
+ int main() {
+ char mem[4+1];
+
+ if(pend(mem).p != mem+4)
+ abort ();
+ }