From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25683 invoked by alias); 5 Feb 2002 05:10:27 -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 25560 invoked from network); 5 Feb 2002 05:10:21 -0000 Received: from unknown (HELO hiauly1.hia.nrc.ca) (132.246.100.193) by sources.redhat.com with SMTP; 5 Feb 2002 05:10:21 -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 g155AJFN021740; Tue, 5 Feb 2002 00:10:19 -0500 (EST) Received: (from dave@localhost) by hiauly1.hia.nrc.ca (8.12.0.Beta16/8.12.0.Beta16) id g155AIxr021739; Tue, 5 Feb 2002 00:10:18 -0500 (EST) Message-Id: <200202050510.g155AIxr021739@hiauly1.hia.nrc.ca> Subject: Re: PATCH: Re: ICE in 920624-1.c with -O3 -funroll-loops on To: law@redhat.com Date: Mon, 04 Feb 2002 22:10:00 -0000 From: "John David Anglin" Cc: rth@redhat.com, gcc-bugs@gcc.gnu.org, jh@suse.cz, gcc-patches@gcc.gnu.org In-Reply-To: <13368.1012879798@porcupine.cygnus.com> from "law@redhat.com" at Feb 4, 2002 08:29:58 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/msg00338.txt.bz2 > What we could do in the short term is to delete the jump table when we > optimize the jump, but leave the CODE_LABEL alone. That deals with the > immediate problem of needing to get unused jump tables out of the insn > stream. By leaving the CODE_LABEL in the stream we avoid dangling > references in normal insns which used that label for computations. That's what my first patch did. However, Honza pointed out that it is valid for a case pattern to appear to use the jump table but in fact do an indirect branch using a pointer. If you kill the jump table, then you need to kill the jumps first and they are difficult to locate. However, this does not apply to the VAX and I believe the jump table can be safely deleted. My current proposal essentially creates for the VAX the same situation as we currently have on the PA (ie., the jump table remains around until removed by dead code analysis). Obviously, not as nice as your suggestion below but it seems to work. The situations where a switch gets folded are relatively rare. Loop unrolling is where I first noted the problem. Thus, unless you are aware of other bugs affected by this problem, I would defer a better fix until after 3.1 branches. The current patch only affects the VAX because it is the only port that defines CASE_DROPS_THROUGH, and thereby the only port where the case insn is folded to a jump directed to the label before the jump table. Thus, I don't believe patch will affect any other port. > Looking into the future, we need some way to have those pesky computation > insns reference a widget which is attached (along with the jump table) to > the tablejump insn. [ The widget is a magic code label, of course. ] > > By having all 3 key items (tablejump, jump table and magic code label) in a > single insn we avoid all the mess of knowing that magic items follow table > jumps which must be kept in specific orders, and we avoid having random crud > existing between basic blocks. Sounds wonderful. In thinking about this, it became clear that separating these components was just asking for trouble. Dave -- J. David Anglin dave.anglin@nrc.ca National Research Council of Canada (613) 990-0752 (FAX: 952-6605)