From patchwork Fri Jul 16 12:43:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bingfeng Mei X-Patchwork-Id: 59102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 83449B6F04 for ; Fri, 16 Jul 2010 22:44:03 +1000 (EST) Received: (qmail 3707 invoked by alias); 16 Jul 2010 12:44:01 -0000 Received: (qmail 3696 invoked by uid 22791); 16 Jul 2010 12:44:01 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mms3.broadcom.com (HELO MMS3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Jul 2010 12:43:56 +0000 Received: from [10.16.192.232] by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Fri, 16 Jul 2010 05:43:42 -0700 X-Server-Uuid: B55A25B1-5D7D-41F8-BC53-C57E7AD3C201 Received: from SJEXCHCCR02.corp.ad.broadcom.com ([10.16.192.130]) by SJEXCHHUB02.corp.ad.broadcom.com ([10.16.192.232]) with mapi; Fri, 16 Jul 2010 05:43:38 -0700 From: "Bingfeng Mei" To: "Jakub Jelinek" cc: "gcc-patches@gcc.gnu.org" Date: Fri, 16 Jul 2010 05:43:33 -0700 Subject: RE: [PATCH] fixed two issues in handling debug_insn. Message-ID: <7FB04A5C213E9943A72EE127DB74F0ADA6897AD008@SJEXCHCCR02.corp.ad.broadcom.com> References: <7FB04A5C213E9943A72EE127DB74F0ADA6897ACFF2@SJEXCHCCR02.corp.ad.broadcom.com> <20100716122420.GT20208@tyan-ft48-01.lab.bos.redhat.com> <7FB04A5C213E9943A72EE127DB74F0ADA6897ACFFB@SJEXCHCCR02.corp.ad.broadcom.com> <20100716123734.GU20208@tyan-ft48-01.lab.bos.redhat.com> In-Reply-To: <20100716123734.GU20208@tyan-ft48-01.lab.bos.redhat.com> MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Sorry, I am a bit careless. Thanks. Bingfeng > -----Original Message----- > From: Jakub Jelinek [mailto:jakub@redhat.com] > Sent: 16 July 2010 13:38 > To: Bingfeng Mei > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [PATCH] fixed two issues in handling debug_insn. > > On Fri, Jul 16, 2010 at 05:27:40AM -0700, Bingfeng Mei wrote: > > Well, I don't know that function. Here is the updated patch. OK for > > trunk & 4.5? > > > + rtx prev_insn = prev_nondebug_insn (doloop_pat); > > > > /* We expect the decrement to immediately precede the branch. > */ > > > > if ((PREV_INSN (doloop_pat) == NULL_RTX) > > - || !INSN_P (PREV_INSN (doloop_pat))) > > + || !INSN_P (prev_insn)) > > return 0; > > This will crash if PREV_INSN is non-NULL, but prev_nondebug_insn > returns > NULL. And, please remove the redundant parens and unnecessary > splitting > of the condition on two lines, i.e. what I wrote: > > if (prev_insn == NULL_RTX || !INSN_P (prev_insn)) > > It looks good to me with those changes (also the ddg.c change), but I > can't > approve this. > > Jakub Index: ddg.c =================================================================== --- ddg.c (revision 162258) +++ ddg.c (working copy) @@ -488,7 +488,7 @@ } /* There is nothing to do for this BB. */ - if (num_nodes <= 1) + if ((num_nodes - g->num_debug) <= 1) { free (g); return NULL; Index: loop-doloop.c =================================================================== --- loop-doloop.c (revision 162258) +++ loop-doloop.c (working copy) @@ -104,11 +104,11 @@ if (GET_CODE (pattern) != PARALLEL) { rtx cond; + rtx prev_insn = prev_nondebug_insn (doloop_pat); /* We expect the decrement to immediately precede the branch. */ - if ((PREV_INSN (doloop_pat) == NULL_RTX) - || !INSN_P (PREV_INSN (doloop_pat))) + if (prev_insn == NULL_RTX || !INSN_P (prev_insn)) return 0; cmp = pattern;