From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7391 invoked by alias); 12 Apr 2005 14:39:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 7065 invoked by alias); 12 Apr 2005 14:38:46 -0000 Date: Tue, 12 Apr 2005 14:39:00 -0000 Message-ID: <20050412143846.7064.qmail@sourceware.org> From: "roger at eyesopen dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050221214433.20126.jkohen@users.sourceforge.net> References: <20050221214433.20126.jkohen@users.sourceforge.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/20126] [3.3/3.4/4.0 Regression] Inlined memcmp makes one argument null on entry X-Bugzilla-Reason: CC X-SW-Source: 2005-04/txt/msg01561.txt.bz2 List-Id: ------- Additional Comments From roger at eyesopen dot com 2005-04-12 14:38 ------- Subject: Re: [PR target/20126, RFC] loop DEST_ADDR biv replacement may fail Hi Alexandre, On 12 Apr 2005, Alexandre Oliva wrote: > Does any expert in rtl loop care to chime in? I'm not sure I qualify for the title "rtl loop" expert, but setting bl->all_reduced to zero after we fail to validate a change to the RTL looks to be a reasonable failure mode. I still like your fallbacks, that by trying harder we perform better optimization, but as shown by the ARM's "stmia" instruction I suspect there will always be cases were we can't reduce IV expressions in some backend instructions. Previously, we didn't even detect these cases and potentially generated bad code. I think the ICE was an improvement over the "potentially" bad code, but what we really need is a more graceful failure/degradation. As you propose, I'd recommend something like (for your final clause): /* If it wasn't a reg, create a pseudo and use that. */ rtx reg, seq; start_sequence (); reg = force_reg (v->mode, *v->location); ! if (validate_change_maybe_volatile (v->insn, v->location, reg)) ! { ! seq = get_insns (); ! end_sequence (); ! loop_insn_emit_before (loop, 0, v->insn, seq); ! } ! else ! { ! end_sequence (); ! if (loop_dump_stream) ! fprintf (loop_dump_stream, ! "unable to reduce iv to register in insn %d\n", ! INSN_UID (v->insn)); ! bl->all_reduced = 0; ! v->ignore = 1; ! continue; ! } I think its worthwhile keeping the validate_change_maybe_volatile calls/changes on mainline. But then for gcc 4.0.0 or 4.0.1 we can use the much simpler: if (v->giv_type == DEST_ADDR) /* Store reduced reg as the address in the memref where we found this giv. */ ! { ! if (!validate_change (v->insn, v->location, v->new_reg, 0)) ! { ! if (loop_dump_stream) ! fprintf (loop_dump_stream, ! "unable to reduce iv to register in insn %d\n", ! INSN_UID (v->insn)); ! bl->all_reduced = 0; ! v->ignore = 1; ! continue; ! } ! } A much less intrusive regression fix than previously proposed fix for 4.0. But perhaps one of the real "rtl loop" experts would like to comment? Roger -- -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20126