This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] Correct simplify_replace_rtx usage in cse_insn
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Apr 2004 14:21:11 -0600 (MDT)
- Subject: [Committed] Correct simplify_replace_rtx usage in cse_insn
Unlike replace_rtx which modifies its argument in-place (assuming no
RTL sharing), simplify_replace_rtx returns a possibly modified tree.
The use of simplify_replace_rtx in cse_insn to update the REG_EQUAL
note on a final libcall instruction assumed the former behaviour, and
therefore didn't actually update the contents of the REG_EQUAL note.
The patch below corrects this mistake, by explicitly replacing the
contents of the appropriate REG_EQUAL note with the RTX returned from
simplify_replace_rtx.
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all languages except treelang, and regression tested
with a top-level "make -k check" with no new failures.
Committed to mainline CVS.
2004-04-04 Roger Sayle <roger@eyesopen.com>
* cse.c (cse_insn): Correct usage of simplify_replace_rtx when
updating the REG_EQUAL note on an insn's libcall_insn.
Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.297
diff -c -3 -p -r1.297 cse.c
*** cse.c 20 Mar 2004 23:03:02 -0000 1.297
--- cse.c 4 Apr 2004 18:21:35 -0000
*************** cse_insn (rtx insn, rtx libcall_insn)
*** 5402,5409 ****
&& (GET_CODE (sets[i].orig_src) == REG
|| GET_CODE (sets[i].orig_src) == SUBREG
|| GET_CODE (sets[i].orig_src) == MEM))
! simplify_replace_rtx (REG_NOTES (libcall_insn),
! sets[i].orig_src, copy_rtx (new));
/* The result of apply_change_group can be ignored; see
canon_reg. */
--- 5402,5414 ----
&& (GET_CODE (sets[i].orig_src) == REG
|| GET_CODE (sets[i].orig_src) == SUBREG
|| GET_CODE (sets[i].orig_src) == MEM))
! {
! rtx note = find_reg_equal_equiv_note (libcall_insn);
! if (note != 0)
! XEXP (note, 0) = simplify_replace_rtx (XEXP (note, 0),
! sets[i].orig_src,
! copy_rtx (new));
! }
/* The result of apply_change_group can be ignored; see
canon_reg. */
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833