From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19858 invoked by alias); 15 Jul 2004 14:54:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 19658 invoked from network); 15 Jul 2004 14:54:12 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 15 Jul 2004 14:54:12 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i6FEsCe1014185 for ; Thu, 15 Jul 2004 10:54:12 -0400 Received: from [172.16.66.21] (vpn64-21.boston.redhat.com [172.16.66.21]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i6FEsB027660 for ; Thu, 15 Jul 2004 10:54:11 -0400 Subject: Fix buglet in previous mechanical loop.c change From: Jeffrey A Law Reply-To: law@redhat.com To: gcc-patches@gcc.gnu.org Content-Type: multipart/mixed; boundary="=-ScCNPX6MyP9kLB+EkSic" Organization: Red Hat, Inc Message-Id: <1089903300.5186.505.camel@speedy> Mime-Version: 1.0 Date: Thu, 15 Jul 2004 19:31:00 -0000 X-SW-Source: 2004-07/txt/msg01547.txt.bz2 --=-ScCNPX6MyP9kLB+EkSic Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1600 The recent change to use various predicates instead of explicitly testing for suitable rtx codes had a minor flaw. Consider this change fragment from loop.c: *************** *** 5482,5495 **** } /* Look for givs which are memory addresses. */ ! if (GET_CODE (p) == INSN) find_mem_givs (loop, PATTERN (p), p, not_every_iteration, maybe_multiple); /* Update the status of whether giv can derive other givs. This can change when we pass a label or an insn that updates a biv. */ ! if (GET_CODE (p) == INSN || GET_CODE (p) == JUMP_INSN ! || GET_CODE (p) == CODE_LABEL) update_giv_derive (loop, p); return p; } --- 5479,5491 ---- } /* Look for givs which are memory addresses. */ ! if (NONJUMP_INSN_P (p)) find_mem_givs (loop, PATTERN (p), p, not_every_iteration, maybe_multiple); /* Update the status of whether giv can derive other givs. This can change when we pass a label or an insn that updates a biv. */ ! if (INSN_P (p)) update_giv_derive (loop, p); return p; } In particular note that we no longer call update_giv_derive if P is a CODE_LABEL. This can cause the loop optimizer to incorrectly reduce a GIV when it's BIV is conditionally incremented. I've been unable to trip this with unmodified sources, but it caused a bootstrap failure (hang building libgcc with the stage2 compiler) with a hacked compiler I'm using to evaluate the jump threading code. This patch restores the previous behavior. Bootstrapped on i686-pc-linux-gnu. --=-ScCNPX6MyP9kLB+EkSic Content-Disposition: attachment; filename=ZZZ Content-Type: text/x-patch; name=ZZZ; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 7bit Content-length: 1402 Index: ChangeLog =================================================================== RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v retrieving revision 2.4542 diff -c -p -r2.4542 ChangeLog *** ChangeLog 15 Jul 2004 13:46:05 -0000 2.4542 --- ChangeLog 15 Jul 2004 14:52:46 -0000 *************** *** 1,3 **** --- 1,8 ---- + 2004-07-15 Jeff Law + + * loop.c (check_insn_for_givs): Restore check for code labels that was + accidentally deleted by a recent checkin. + 2004-07-15 Nathan Sidwell * vec.h (VEC_T_truncate): Allow truncation of an empty vector. Index: loop.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/loop.c,v retrieving revision 1.503 diff -c -p -r1.503 loop.c *** loop.c 9 Jul 2004 03:29:33 -0000 1.503 --- loop.c 15 Jul 2004 14:53:01 -0000 *************** check_insn_for_givs (struct loop *loop, *** 5485,5491 **** /* Update the status of whether giv can derive other givs. This can change when we pass a label or an insn that updates a biv. */ ! if (INSN_P (p)) update_giv_derive (loop, p); return p; } --- 5485,5491 ---- /* Update the status of whether giv can derive other givs. This can change when we pass a label or an insn that updates a biv. */ ! if (INSN_P (p) || LABEL_P (p)) update_giv_derive (loop, p); return p; } --=-ScCNPX6MyP9kLB+EkSic--