From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21045 invoked by alias); 4 Feb 2002 23:37:22 -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 20870 invoked from network); 4 Feb 2002 23:37:19 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 4 Feb 2002 23:37:19 -0000 Received: from hiauly1.hia.nrc.ca (localhost [127.0.0.1]) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) with ESMTP id g14NbEFN020956; Mon, 4 Feb 2002 18:37:15 -0500 (EST) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g14NbDAV020955; Mon, 4 Feb 2002 18:37:13 -0500 (EST) Message-Id: <200202042337.g14NbDAV020955@hiauly1.hia.nrc.ca> Subject: Re: PATCH: Re: ICE in 920624-1.c with -O3 -funroll-loops on vax-dec-ultrix4.3 To: rth@redhat.com (Richard Henderson) Date: Mon, 04 Feb 2002 16:04:00 -0000 From: "John David Anglin" Cc: gcc-bugs@gcc.gnu.org, jh@suse.cz, gcc-patches@gcc.gnu.org In-Reply-To: <20020115190555.A10909@redhat.com> from "Richard Henderson" at Jan 15, 2002 07:05:55 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SW-Source: 2002-02/txt/msg00317.txt.bz2 > On Tue, Jan 15, 2002 at 06:16:14PM -0500, John David Anglin wrote: > > This patch fixes the problem by deleting the jump table data when a > > conditional or computed jump is converted to an unconditional jump. > > I have verified that the patch fixes the original problem observed > > under vax-dec-ultrix4.3. A new vax bootstrap is underway but it > > won't finish until sometime next month. > > This is extremely delicate. It is not uncommon for there to > be references remaining to the jump table that won't be deleted > until later dead code elimination. > > I'm therefore uncomfortable with simply removing it like this. > I'm not sure what to suggest as an alternative though... Does this look better? The patch no longer removes the jump table. It simply changes the branch destination to a new label following the jump table when it detects that the target of the jump is the following insn. The subsequent flow analysis deletes the unused jump table. This should only happen on the vax. Tested on vax-dec-ultrix4.3 and various PA builds for the last month. OK? Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605) 2002-01-16 John David Anglin * cse.c (cse_insn): Fix the destination of unconditional jumps to an immediately following code label, followed by jump table data. --- cse.c.orig Wed Jan 16 12:28:28 2002 +++ cse.c Wed Jan 16 16:50:26 2002 @@ -5767,9 +5767,30 @@ be a conditional or computed branch. */ else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF) { - /* Now emit a BARRIER after the unconditional jump. */ - if (NEXT_INSN (insn) == 0 - || GET_CODE (NEXT_INSN (insn)) != BARRIER) + rtx next = NEXT_INSN (insn); + rtx tmp; + + /* If there is jump table data after the jump and its destination + is now the code label preceding the jump table, change the + destination to a new label after the jump table. This kludge + is needed on the VAX because fold_rtx uses the label before + the jump table in folding a case insn. */ + if (next != NULL_RTX + && LABEL_P (next) + && (tmp = NEXT_INSN (next)) != NULL_RTX + && JUMP_TABLE_DATA_P (tmp) + && XEXP (src, 0) == next) + { + rtx label = gen_label_rtx (); + emit_label_after (label, tmp); + XEXP (src, 0) = label; + --LABEL_NUSES (next); + ++LABEL_NUSES (label); + } + + /* Now emit a BARRIER after the unconditional jump. */ + if (next == NULL_RTX + || GET_CODE (next) != BARRIER) emit_barrier_after (insn); /* We reemit the jump in as many cases as possible just in