From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id E7200382FCA2 for ; Wed, 14 Dec 2022 12:12:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E7200382FCA2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DE8BB1FF59; Wed, 14 Dec 2022 12:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1671019920; 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=QseSzVHT+T8iVyu+f+Sfe5Xnby/rts0CBND9r/1ekVE=; b=gzGxsKG3WxO+8bYe5huTn9ThYPKN/bJv76WGcO1MYynuhze1zQpp1Vg7rg5GQhMgwpe5Ed dRSRAIgiMvyeiJU18dIhiw7YvTSfDV0k1aw39ZhhtdcRF8X49HAa59RXHT+we4SrLrPxZk ulvanui37150ZMguJekV5+kOLxMSGbk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1671019920; 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=QseSzVHT+T8iVyu+f+Sfe5Xnby/rts0CBND9r/1ekVE=; b=u0jdFegQFICF1rE5LLNkwr5cD91jtuu68QPSwE+M6wz85/ZTNNmqRo4YSR989AWCoF5+Nu BSQMMOWhftY0PwAw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D0562138F6; Wed, 14 Dec 2022 12:12:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mV3ZMpC9mWMDWwAAMHmgww (envelope-from ); Wed, 14 Dec 2022 12:12:00 +0000 From: Martin Jambor To: Jan Hubicka Cc: GCC Patches Subject: Re: [PATCH 6/9] ipa-sra: Be optimistic about Fortran descriptors In-Reply-To: References: User-Agent: Notmuch/0.37 (https://notmuchmail.org) Emacs/28.1 (x86_64-suse-linux-gnu) Date: Wed, 14 Dec 2022 13:12:00 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_SOFTFAIL,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Mon, Dec 12 2022, Jan Hubicka wrote: >> Hi, >> >> I'm re-posting patches which I have posted at the end of stage 1 but >> which have not passed review yet. >> >> 8<-------------------------------------------------------------------- >> >> Fortran descriptors are structures which are often constructed just >> for a particular argument of a particular call where it is passed by >> reference. When the called function is under compiler's control, it >> can be beneficial to split up the descriptor and pass it in individual >> parameters. Unfortunately, currently we allow IPA-SRA to replace a >> pointer with a set of replacements which are at most twice as big in >> total and for descriptors we'd need to bump that factor to seven. >> >> This patch looks for parameters which are ADDR_EXPRs of local >> variables which are written to and passed as arguments by reference >> but are never loaded from and marks them with a flag in the call edge >> summary. The IPA analysis phase then identifies formal parameters >> which are always fed such arguments and then is more lenient when it >> comoes to size. >> >> In order not to store to maximums per formal parameter, I calculate >> the more lenient one by multiplying the existing one with a new >> parameter. If it is preferable to keep the maximums independent, we >> can do that. Documentation for the new parameter is missing as I >> still need to re-base the patch on a version which has sphinx. I will >> write it before committing. >> >> I have disable IPA-SRA in pr48636-2.f90 in order to be able to keep >> using its dump-scan expressions. The new testcase is basically a copy >> of it with different options and IPA-SRA dump scans. >> >> Bootstrapped and tested individually when I originally posted it and >> now bootstrapped and LTO-bootstrapped and tested as part of the whole >> series. OK for master? >> >> >> gcc/ChangeLog: >> >> 2022-11-11 Martin Jambor >> >> * ipa-sra.c (isra_param_desc): New field not_specially_constructed. >> (struct isra_param_flow): New field constructed_for_calls. >> (isra_call_summary::dump): Dump the new flag. >> (loaded_decls): New variable. >> (dump_isra_param_descriptor): New parameter hints, dump >> not_specially_constructed if it is true. >> (dump_isra_param_descriptors): New parameter hints, pass it to >> dump_isra_param_descriptor. >> (ipa_sra_function_summaries::duplicate): Duplicate new flag. >> (create_parameter_descriptors): Adjust comment. >> (get_gensum_param_desc): Bail out when decl2desc is NULL. >> (scan_expr_access): Add loaded local variables to loaded_decls. >> (scan_function): Survive if final_bbs is NULL. >> (isra_analyze_call): Compute constructed_for_calls flag. >> (process_scan_results): Be optimistic about size limits. Do not dump >> computed param hints when dumpint IPA-SRA structures. >> (isra_write_edge_summary): Stream constructed_for_calls. >> (isra_read_edge_summary): Likewise. >> (ipa_sra_dump_all_summaries): New parameter hints, pass it to >> dump_isra_param_descriptor. >> (flip_all_hints_pessimistic): New function. >> (flip_all_param_hints_pessimistic): Likewise. >> (propagate_param_hints): Likewise. >> (disable_unavailable_parameters): Renamed to >> adjust_parameter_descriptions. Expand size limits for parameters >> which are specially contstructed by all callers. Check limits again.p >> (ipa_sra_analysis): Pass required hints to ipa_sra_dump_all_summaries. >> Add hint propagation. >> (ipa_sra_summarize_function): Initialize and destory loaded_decls, >> rearrange so that scan_function is called even when there are no >> candidates. >> * params.opt (ipa-sra-ptrwrap-growth-factor): New parameter. > > Hmm, this is quite specific heuristics, but I do not have much better > ideas, so it is OK :) > Yeah, it kind of is. I was wondering whether it should really only target Fortran array descriptors (and have them marked some way) but eventually decided for this - but I do not expect the code to trigger too much for non-Fortran code. > Can this be useful also for inlining? IPA-SRA deallocates its summaries after the analysis phase so we'd need to postpone that for later. Otherwise it should be quite directly usable - perhaps after a check that the "hint propagation" bit of IPA-SRA has been run, the flag starts with the optimistic value. Martin