From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26522 invoked by alias); 11 Oct 2002 22:46:05 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 26414 invoked by uid 71); 11 Oct 2002 22:46:03 -0000 Date: Fri, 11 Oct 2002 15:46:00 -0000 Message-ID: <20021011224603.26413.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Richard Henderson Subject: Re: optimization/8165: builtin string functions SEGV on alpha-pc-linux-gnu at -O2 Reply-To: Richard Henderson X-SW-Source: 2002-10/txt/msg00491.txt.bz2 List-Id: The following reply was made to PR optimization/8165; it has been noted by GNATS. From: Richard Henderson To: Glen Nakamura Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: optimization/8165: builtin string functions SEGV on alpha-pc-linux-gnu at -O2 Date: Fri, 11 Oct 2002 15:44:48 -0700 You're right about the REG_EQUAL note being bogus, but as I feared, the fix was in the wrong place. The problem has nothing to do with lo_sum in specific, but is a generic issue with local cprop failing to update notes. Addressed thus. r~ * gcse.c (adjust_libcall_notes): Also adjust notes for INSN. Index: gcse.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/gcse.c,v retrieving revision 1.220 diff -u -p -r1.220 gcse.c --- gcse.c 30 Sep 2002 13:00:29 -0000 1.220 +++ gcse.c 11 Oct 2002 07:51:06 -0000 @@ -4251,6 +4251,7 @@ cprop_insn (insn, alter_jumps) /* LIBCALL_SP is a zero-terminated array of insns at the end of a libcall; their REG_EQUAL notes need updating. */ + static bool do_local_cprop (x, insn, alter_jumps, libcall_sp) rtx x; @@ -4260,10 +4261,12 @@ do_local_cprop (x, insn, alter_jumps, li { rtx newreg = NULL, newcnst = NULL; - /* Rule out USE instructions and ASM statements as we don't want to change the hard registers mentioned. */ + /* Rule out USE instructions and ASM statements as we don't want to + change the hard registers mentioned. */ if (GET_CODE (x) == REG && (REGNO (x) >= FIRST_PSEUDO_REGISTER - || (GET_CODE (PATTERN (insn)) != USE && asm_noperands (PATTERN (insn)) < 0))) + || (GET_CODE (PATTERN (insn)) != USE + && asm_noperands (PATTERN (insn)) < 0))) { cselib_val *val = cselib_lookup (x, GET_MODE (x), 0); struct elt_loc_list *l; @@ -4327,17 +4330,23 @@ do_local_cprop (x, insn, alter_jumps, li /* LIBCALL_SP is a zero-terminated array of insns at the end of a libcall; their REG_EQUAL notes need updating to reflect that OLDREG has been - replaced with NEWVAL in INSN. Return true if all substitutions could - be made. */ + replaced with NEWVAL in INSN. Also update the REG_EQUAL notes in INSN. + + Return true if all substitutions could be made. */ + static bool adjust_libcall_notes (oldreg, newval, insn, libcall_sp) rtx oldreg, newval, insn, *libcall_sp; { - rtx end; + rtx end, note; + + note = find_reg_equal_equiv_note (insn); + if (note) + XEXP (note, 0) = replace_rtx (XEXP (note, 0), oldreg, newval); while ((end = *libcall_sp++)) { - rtx note = find_reg_equal_equiv_note (end); + note = find_reg_equal_equiv_note (end); if (! note) continue;