From patchwork Fri Nov 2 08:08:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 196508 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 71F0B2C0317 for ; Fri, 2 Nov 2012 19:09:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352448549; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=/kQY+W6msdN1TemwcSYZFN9Lz9c=; b=U+pKGF/MqGDMN93 nq6wecSUFUfj4OxDJp3dxX5ONBsWeU09USRmiM3im6DHo7F54ADpzTnNAL1vQo+3 L+itiA2OxcepzYrtiQFdQe0ToYK8OoTnWDnRO1fWZ+c5RKaHW/6YwnTcaKdmbvjE Et05wzkcvQ448bWl3w63CmR0GDQ8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=JtEn7pzMUIzd1Um1kDPrH1RDdOW7ghFp+K3nSMESpoHe+Cw8GPePPGbTEFzIbo /boBiXkPPEy/MUbF9e+lTw4sxMZ6z+dbOSjP7PkCN9fn4fYvc/uypfFrbV/RBRhy fD2njndR9+zIRxIKuJUi9xzV2eT56UxaHlScJI6O+B2oY=; Received: (qmail 12664 invoked by alias); 2 Nov 2012 08:08:57 -0000 Received: (qmail 12639 invoked by uid 22791); 2 Nov 2012 08:08:55 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 08:08:48 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA288mMw008945 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 2 Nov 2012 04:08:48 -0400 Received: from zalov.redhat.com (vpn1-4-38.ams2.redhat.com [10.36.4.38]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qA288k7w022321 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 2 Nov 2012 04:08:48 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qA288k3f002585; Fri, 2 Nov 2012 09:08:46 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qA288kuf002584; Fri, 2 Nov 2012 09:08:46 +0100 Date: Fri, 2 Nov 2012 09:08:45 +0100 From: Jakub Jelinek To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Subject: Re: [PR54693] loss of debug info in jump threading and loop ivopts Message-ID: <20121102080845.GB1881@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20121101092756.GF1891@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121101092756.GF1891@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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 On Thu, Nov 01, 2012 at 10:27:57AM +0100, Jakub Jelinek wrote: > The patch unfortunately doesn't speed test-tgmath2.i compilation > significantly, but decreases number of debug stmts from ~ 36000 to ~ 16000, > the 20000+ were clearly redundant. Testing found a buglet in the patch (doing is_gimple_debug (gsi_stmt (gsi)) even when there might be no stmts after labels in the successor at all), fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-11-02 Jakub Jelinek PR debug/54402 * tree-ssa-threadedge.c (thread_around_empty_block): Don't copy over debug stmts if the successor bb already starts with a debug stmt for the same var. Jakub --- gcc/tree-ssa-threadedge.c.jj 2012-10-30 09:01:15.000000000 +0100 +++ gcc/tree-ssa-threadedge.c 2012-11-01 10:07:29.114499218 +0100 @@ -1,5 +1,5 @@ /* SSA Jump Threading - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Jeff Law @@ -641,18 +641,62 @@ thread_around_empty_block (edge taken_ed we don't lose the bindings as we redirect the edges. */ if (MAY_HAVE_DEBUG_STMTS) { + struct pointer_set_t *vars = NULL; + gsi = gsi_after_labels (bb); for (gimple_stmt_iterator si = gsi_last_bb (taken_edge->src); !gsi_end_p (si); gsi_prev (&si)) { + tree var; + stmt = gsi_stmt (si); if (!is_gimple_debug (stmt)) continue; + var = NULL_TREE; + if (gimple_debug_bind_p (stmt)) + var = gimple_debug_bind_get_var (stmt); + else if (gimple_debug_source_bind_p (stmt)) + var = gimple_debug_source_bind_get_var (stmt); + + /* Don't insert debug stmts for vars which will be immediately + overridden by debug stmts at the start of bb (either preexisting + or from earlier thread_around_empty_block attempt), without + any intervening real stmts. */ + if (var != NULL_TREE + && !gsi_end_p (gsi) + && is_gimple_debug (gsi_stmt (gsi))) + { + if (vars == NULL) + { + gimple_stmt_iterator gsi2; + vars = pointer_set_create (); + for (gsi2 = gsi; !gsi_end_p (gsi2); gsi_next (&gsi2)) + { + gimple stmt2 = gsi_stmt (gsi2); + tree var2; + if (!is_gimple_debug (stmt2)) + break; + if (gimple_debug_bind_p (stmt2)) + var2 = gimple_debug_bind_get_var (stmt2); + else if (gimple_debug_source_bind_p (stmt2)) + var2 = gimple_debug_source_bind_get_var (stmt2); + else + continue; + pointer_set_insert (vars, var2); + } + } + if (pointer_set_insert (vars, var)) + continue; + } + stmt = gimple_copy (stmt); /* ??? Should we drop the location of the copy? */ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT); } + + if (vars != NULL) + pointer_set_destroy (vars); } /* This block must have more than one successor. */