From patchwork Sun Jun 20 23:57:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 56279 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 BC978B7D86 for ; Mon, 21 Jun 2010 09:57:47 +1000 (EST) Received: (qmail 14276 invoked by alias); 20 Jun 2010 23:57:45 -0000 Received: (qmail 14268 invoked by uid 22791); 20 Jun 2010 23:57:44 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS 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; Sun, 20 Jun 2010 23:57:38 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5KNvb3p006512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 20 Jun 2010 19:57:37 -0400 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5KNvZp9006070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Jun 2010 19:57:36 -0400 Received: from livre.localdomain (livre.oliva.athome.lsd.ic.unicamp.br [172.31.160.2]) by localhost.localdomain (8.14.3/8.14.3) with ESMTP id o5KNvZAY000835; Sun, 20 Jun 2010 20:57:35 -0300 Received: from livre.localdomain (aoliva@localhost [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o5KNvXue012023; Sun, 20 Jun 2010 20:57:34 -0300 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id o5KNvW1t012021; Sun, 20 Jun 2010 20:57:32 -0300 From: Alexandre Oliva To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Subject: Re: [PR44248] Fix lto/whopr -g link-time -fcompare-debug failure References: Date: Sun, 20 Jun 2010 20:57:31 -0300 In-Reply-To: (Richard Guenther's message of "Fri, 18 Jun 2010 11:20:45 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 Jun 18, 2010, Richard Guenther wrote: > Ok if you add a comment like /* Remove debug statements only > here to preserve gimple uid numbering. */ Thanks for the reminder. I made it a bit more verbose. for gcc/ChangeLog from Alexandre Oliva PR debug/44248 * lto-streamer-in.c (input_bb): Leave debug stmts alone. (input_function): Drop them here, if VTA is disabled. Index: gcc/lto-streamer-in.c =================================================================== --- gcc/lto-streamer-in.c.orig 2010-06-20 20:48:00.000000000 -0300 +++ gcc/lto-streamer-in.c 2010-06-20 20:55:22.000000000 -0300 @@ -1204,13 +1204,6 @@ input_bb (struct lto_input_block *ib, en { gimple stmt = input_gimple_stmt (ib, data_in, fn, tag); - /* Change debug stmts to nops on-the-fly if we do not have VTA enabled. - This allows us to build for example static libs with debugging - enabled and do the final link without. */ - if (!MAY_HAVE_DEBUG_STMTS - && is_gimple_debug (stmt)) - stmt = gimple_build_nop (); - find_referenced_vars_in (stmt); gsi_insert_after (&bsi, stmt, GSI_NEW_STMT); @@ -1370,11 +1363,26 @@ input_function (tree fn_decl, struct dat stmts = (gimple *) xcalloc (gimple_stmt_max_uid (fn), sizeof (gimple)); FOR_ALL_BB (bb) { - gimple_stmt_iterator bsi; - for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + gimple_stmt_iterator bsi = gsi_start_bb (bb); + while (!gsi_end_p (bsi)) { gimple stmt = gsi_stmt (bsi); - stmts[gimple_uid (stmt)] = stmt; + /* If we're recompiling LTO objects with debug stmts but + we're not supposed to have debug stmts, remove them now. + We can't remove them earlier because this would cause uid + mismatches in fixups, but we can do it at this point, as + long as debug stmts don't require fixups. */ + if (!MAY_HAVE_DEBUG_STMTS && is_gimple_debug (stmt)) + { + gimple_stmt_iterator gsi = bsi; + gsi_next (&bsi); + gsi_remove (&gsi, true); + } + else + { + gsi_next (&bsi); + stmts[gimple_uid (stmt)] = stmt; + } } }