From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1FF233858D35 for ; Fri, 5 Nov 2021 06:58:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1FF233858D35 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E04BE1FD33 for ; Fri, 5 Nov 2021 06:58:24 +0000 (UTC) Received: from murzim.suse.de (murzim.suse.de [10.160.4.192]) (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 BF44F2C144; Fri, 5 Nov 2021 06:58:24 +0000 (UTC) Date: Fri, 5 Nov 2021 07:58:24 +0100 (CET) From: Richard Biener To: Martin Jambor cc: GCC Patches Subject: Re: [PATCH] ipa-sra: Improve debug info for removed parameters (PR 93385) In-Reply-To: Message-ID: <479p7o4-o687-qsss-so82-8o41s158o48@fhfr.qr> References: <625339q-6132-6s31-q512-oq8q71rq9or9@fhfr.qr> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-5.1 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: Fri, 05 Nov 2021 06:58:29 -0000 On Thu, 4 Nov 2021, Martin Jambor wrote: > 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); I'm not sure why the difference matters - I'd have to dig in history. The only place where this tends to differ is for FIELD_DECLs, but 'value' shouldn't be such one. And looking at the "value" for this looks odd anyhow. That said, I'd simply leave those cases in place (or simply re-set the mode as they do now). > Should build_debug_expr_decl's parameter be perhaps more general, > allowing both DECLs, TYPEs and use its TREE_TYPE if it is neither)? No, I don't like that option much. > 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. > -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)