From patchwork Sat Oct 27 18:07:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 194627 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 B7D762C0084 for ; Sun, 28 Oct 2012 05:07:32 +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=1351966054; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=k/tftF/UB05CC7VQknO14WTLR14=; b=JCUj/cqGPes8UETVcUD0SmbObGMtldffMfb8eulioqeK5xQ5IAp7kfRs6l29Lc g7cDXPGFT279DnCe8iw8Vi7PIFLZKun2eKEVNTjkuLpCQK9RBHbGsR9HUPzsyAjK iqsR1hKdDUdQ80g+NPCqWcsmLoH37FQWskm3MSFWGZeSc= 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:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=eXmCYBjKt5OeXr/Tn3vQ81T9D+ZuQeNP9vmD52SkzB3NkZa1wS6z95s1oLQZ+T wp6OEAnladM2LLqdcyNKKNzJRS/fM1Q/6UZw3xp2PrHzF8ygQQaQe6Ie1JmF6i/E lkO/P0d+3P13s0moRVSW7uZ/TK6JIpOxO6hncaqxgNw8c=; Received: (qmail 4327 invoked by alias); 27 Oct 2012 18:07:27 -0000 Received: (qmail 4318 invoked by uid 22791); 27 Oct 2012 18:07:26 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_TM X-Spam-Check-By: sourceware.org Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 27 Oct 2012 18:07:20 +0000 Received: by mail-ob0-f175.google.com with SMTP id eq6so3770439obc.20 for ; Sat, 27 Oct 2012 11:07:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.60.171.72 with SMTP id as8mr13609260oec.140.1351361240282; Sat, 27 Oct 2012 11:07:20 -0700 (PDT) Received: by 10.76.95.202 with HTTP; Sat, 27 Oct 2012 11:07:20 -0700 (PDT) In-Reply-To: References: <1945668.Pu87KJAiWx@polaris> Date: Sat, 27 Oct 2012 20:07:20 +0200 Message-ID: Subject: Re: [PATCH] Fix debug info for expr and jump stmt From: Richard Biener To: Dehao Chen Cc: Michael Matz , Eric Botcazou , GCC Patches , Jason Merrill 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 Sat, Oct 27, 2012 at 12:53 AM, Dehao Chen wrote: > Hi, > > I've updated the patch: > > 1. abandon the changes in cfgexpand.c > 2. set the block for trees when lowering gimple stmt. > 3. add a unittest. why do you need this? The stmt location is taken from the operands and in fact they may have more precise locations. So it seems completely pointless to me (wasting location entries where a NULL block is just fine (take the block from the stmt)). So, what is the issue you try to fix? Yes, the stmt operands will keep the BLOCK live, but it is live if the frontend assigned it. Richard. > However, this patch will trigger two lto bug when asserting > LTO_NO_PREVAIL for TREE_CHAIN. After debugging for a while, I found > that the problem was also there even without the patch. This patch > just reveal the problem by moving a decl into cache so that it will be > checked. As I'm not familiar with LTO, not quite sure what the root > problem is. Can anyone help take a look? > > Thanks, > Dehao > > gcc/ChangeLog: > 2012-10-25 Dehao Chen > > * tree-eh.c (do_return_redirection): Set location for jump statement. > (do_goto_redirection): Likewise. > (frob_into_branch_around): Likewise. > (lower_try_finally_nofallthru): Likewise. > (lower_try_finally_copy): Likewise. > (lower_try_finally_switch): Likewise. > * gimple-low.c (tree_set_block_r): New callback function. > (lower_stmt): Set block for tested expr. > > gcc/testsuite/ChangeLog: > 2012-10-25 Dehao Chen > > * g++.dg/debug/dwarf2/block.C: New testcase. Index: gcc/gimple-low.c =================================================================== --- gcc/gimple-low.c (revision 192809) +++ gcc/gimple-low.c (working copy) @@ -331,7 +331,18 @@ lower_omp_directive (gimple_stmt_iterator *gsi, st gsi_next (gsi); } +/* Call back function to set the block for expr. */ +static tree +tree_set_block_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, + void *data) +{ + tree block = (tree) data; + if (CAN_HAVE_LOCATION_P (*tp)) + TREE_SET_BLOCK (*tp, block); + return NULL_TREE; +} + /* Lower statement GSI. DATA is passed through the recursion. We try to track the fallthruness of statements and get rid of unreachable return statements in order to prevent the EH lowering pass from adding useless @@ -343,8 +354,11 @@ static void lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data) { gimple stmt = gsi_stmt (*gsi); + unsigned i; gimple_set_block (stmt, data->block); + for (i = 0; i < gimple_num_ops (stmt); i++) + walk_tree (gimple_op_ptr (stmt, i), tree_set_block_r, data->block, NULL); switch (gimple_code (stmt)) {