From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id E0791385840B for ; Thu, 4 Nov 2021 16:55:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0791385840B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1D06921981 for ; Thu, 4 Nov 2021 16:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1636044921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DxXSLAcfDa6rcXbawXHJrE4QggeT2MaqNfrnKggAggQ=; b=iwrpM9UbkxdCXkX8iosSXkqVEHoiPtpWGwL+c00svn4qXQ2arQcYIgg+rDPwiDhuOgES19 A9XUSugLEiZCUJaIIQ+fRR9vPbF5ChecZoVGyWtm1F0tHEfeIztKv3B7UaKWxqiiZzxkFd DhHWeFe7hitbmIqDX/Yd5Nt6G5XFRiQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1636044921; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DxXSLAcfDa6rcXbawXHJrE4QggeT2MaqNfrnKggAggQ=; b=76iOFDXma6gXvvgL0HAmKEYzo4oI7XFQ5AHwxmbVEV9w+1kvu3LdIdI8j6bnwkbiEwxQ0a Ff4xTlHc70R1ZQBw== Received: from suse.cz (virgil.suse.cz [10.100.13.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0957B2C167; Thu, 4 Nov 2021 16:55:21 +0000 (UTC) From: Martin Jambor To: Richard Biener Cc: GCC Patches Subject: Re: [PATCH] ipa-sra: Improve debug info for removed parameters (PR 93385) In-Reply-To: <625339q-6132-6s31-q512-oq8q71rq9or9@fhfr.qr> References: <625339q-6132-6s31-q512-oq8q71rq9or9@fhfr.qr> User-Agent: Notmuch/0.33.2 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Thu, 04 Nov 2021 17:55:20 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2021 16:55:24 -0000 Hi, On Wed, Nov 03 2021, Richard Biener wrote: > On Mon, 1 Nov 2021, Martin Jambor wrote: > >> Hello, >> >> I'd like to ping this patch. >> >> Thanks, >> >> Martin >> >> >> On Wed, Oct 13 2021, Martin Jambor wrote: >> > Hi, >> > >> > in spring I added code eliminating any statements using parameters >> > removed by IPA passes (to fix PR 93385). That patch fixed issues such >> > as divisions by zero that such code could perform but it only reset >> > all affected debug bind statements, this one updates them with >> > expressions which can allow the debugger to print the removed value - >> > see the added test-case for an example. >> > [...] >> > >> > Bootstrapped and tested on x86_64-linux, i686-linux and (long time >> > ago) on aarch64-linux. Also LTO-bootstrapped and on x86_64-linux. >> > >> > Perhaps it is good to go to trunk? > > I think the patch is OK for trunk. It would be nice to common the Thank you very much, I will commit the patch shortly after a rebase and a final test. > > + tree vexpr = make_node (DEBUG_EXPR_DECL); > + DECL_ARTIFICIAL (vexpr) = 1; > + TREE_TYPE (vexpr) = TREE_TYPE (val); > + SET_DECL_MODE (vexpr, TYPE_MODE (TREE_TYPE (val))); > > blob that exists all over the GCC code base with a new > build_debug_expr_decl (tree type) (next to tree.c:build_decl). > That makes sense, I'll prepare a patch as a follow-up. A minority of places in GCC which produce a DEBUG_DECL_EXPR however set its mode like cfgexpand.c does: tree vexpr = make_node (DEBUG_EXPR_DECL); DECL_ARTIFICIAL (vexpr) = 1; TREE_TYPE (vexpr) = TREE_TYPE (value); if (DECL_P (value)) mode = DECL_MODE (value); else mode = TYPE_MODE (TREE_TYPE (value)); SET_DECL_MODE (vexpr, mode); Should build_debug_expr_decl's parameter be perhaps more general, allowing both DECLs, TYPEs and use its TREE_TYPE if it is neither)? Or should I leave such places as they are and only convert those that set the mode to TYPE_MODE (type)? Thanks, Martin >> > >> > gcc/ChangeLog: >> > >> > 2021-03-29 Martin Jambor >> > >> > PR ipa/93385 >> > * ipa-param-manipulation.h (class ipa_param_body_adjustments): New >> > members remap_with_debug_expressions, m_dead_ssa_debug_equiv, >> > m_dead_stmt_debug_equiv and prepare_debug_expressions. Added >> > parameter to mark_dead_statements. >> > * ipa-param-manipulation.c: Include tree-phinodes.h and cfgexpand.h. >> > (ipa_param_body_adjustments::mark_dead_statements): New parameter >> > debugstack, push into it all SSA names used in debug statements, >> > produce m_dead_ssa_debug_equiv mapping for the removed param. >> > (replace_with_mapped_expr): New function. >> > (ipa_param_body_adjustments::remap_with_debug_expressions): Likewise. >> > (ipa_param_body_adjustments::prepare_debug_expressions): Likewise. >> > (ipa_param_body_adjustments::common_initialization): Gather and >> > procecc SSA which will be removed but are in debug statements. Simplify. >> > (ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize >> > new members. >> > * tree-inline.c (remap_gimple_stmt): Create a debug bind when possible >> > when avoiding a copy of an unnecessary statement. Remap removed SSA >> > names in existing debug statements. >> > (tree_function_versioning): Do not create DEBUG_EXPR_DECL for removed >> > parameters if we have already done so. >> > >> > gcc/testsuite/ChangeLog: >> > >> > 2021-03-29 Martin Jambor >> > >> > PR ipa/93385 >> > * gcc.dg/guality/ipa-sra-1.c: New test.