From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by sourceware.org (Postfix) with ESMTPS id 39ED838133DB for ; Thu, 2 Jun 2022 07:46:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39ED838133DB Received: by mail-pg1-f172.google.com with SMTP id y187so4097983pgd.3 for ; Thu, 02 Jun 2022 00:46:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=upWfC3i6fbIQcf8V0A54TvezZ6j8/24qY1r4vhk8xwE=; b=W9KySpf2I5dx2usPizeL50NON6RFXVLp8i2RV4dUL2gtUaoCjq4EhFGPgL19v0ggg/ hqoVnX6HWIMhUY4FwX8Hva993TeL7LyozxND18TR10fqWtAD6t4IXlXaCQZT1K9rCv5f ZuUkOuYvU2Q2DJTsPq/siHbPHRlSvQVOpevfiorWsOkc3vpzYogBLJ1zSYnFUKgkBodA 2QPqOkpYUXWTp9qWwuNOxuKehXC+nHgnaiOsIIrytPq1C/qT1W2Kl8R2PcViUWTq95zk fruXVaknxYzJng/466Bz522lDMFWDtT9jsEJmDnBKb8LG10laF83ERKHR6Bvjg39/ljH cx1g== X-Gm-Message-State: AOAM532tkYQop/R1YFinhtVyBJAQiS+QcAn/eWDN+bkE3CqnxtpKDPVS OwJSJz5EsO+Vxp9NqhhCid3lzVDxeXq7iA== X-Google-Smtp-Source: ABdhPJzaKRHbBaxlS9fWUyHrzmpB12zjALq24Pe0tA7ptr1cZ6lFmKA7r7f+cQAYG5ltYrmYutvwUA== X-Received: by 2002:a65:6205:0:b0:3f5:d436:5446 with SMTP id d5-20020a656205000000b003f5d4365446mr3082716pgv.532.1654155963814; Thu, 02 Jun 2022 00:46:03 -0700 (PDT) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com. [209.85.216.52]) by smtp.gmail.com with ESMTPSA id i6-20020a17090332c600b0015ea9aabd19sm2779254plr.241.2022.06.02.00.46.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jun 2022 00:46:03 -0700 (PDT) Received: by mail-pj1-f52.google.com with SMTP id u12-20020a17090a1d4c00b001df78c7c209so8633566pju.1 for ; Thu, 02 Jun 2022 00:46:03 -0700 (PDT) X-Received: by 2002:a17:902:f34c:b0:163:fa4f:2ff5 with SMTP id q12-20020a170902f34c00b00163fa4f2ff5mr3537725ple.174.1654155962929; Thu, 02 Jun 2022 00:46:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Erick Ochoa Date: Thu, 2 Jun 2022 09:45:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Question on cgraph_edge::call_stmt during LTO To: Martin Jambor Cc: gcc@gcc.gnu.org X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jun 2022 07:46:07 -0000 Hi Martin, Thanks for the tips! I have implemented an edge summary which: * is allocated at IPA analysis phase * streamed out in ipcp_write_transformation_summaries * streamed in in ipcp_read_transformation_summaries However, before the implementation of this edge summary we had another mechanism of propagating the information all the way until it was used in a SIMPLE_IPA_PASS executed after all LGEN stages were finished (after all_regular_ipa_passes). After changing the implementation to use edge summaries, I find that the information is conserved during inlining (the duplication hook prints out the new edges that gets formed via inlining with the correct information), however it is not found in the SIMPLE_IPA_PASS that gets executed after all_regular_ipa_passes. What is perhaps more interesting is that if I run with -fno-ipa-pure-const and no -fno-ipa-modref, I can still see the cgraph_nodes and edges of the inlined methods, along with the information needed. But not in the ones that have been inlined. I believe this could be just that when these options are disabled, cgraph_nodes might not be reclaimed. I understand that there are many differences between SIMPLE_IPA_PASSes and regular IPA_PASSes, but at the moment I am unsure how to narrow down my search for a fix. Is this something that could be caused by: * memory management: (I am not familiar with the memory management in GCC and it is a bit difficult to understand.) I have removed the bodies of the my_edge_summary::remove (cgraph_edge*) and my_edge_summary::remove (cgraph_edge *, my_edge_summary_instance *) so I don't think this might be it. However, the class my_edge_summary still copies some of the structure in the other transformation summaries, so there is a macro GTY((for_user)) in the class declaration and the information is stored in a vec *my_info. * missing implementation details in the duplicate functions: Looking at ipa_edge_args_sum_t::duplicate, it is a relatively complex function. I also noticed that it does something else when the dst->caller has been inlined. Should I also update the cgraph_edge that disappears when dst->caller is inlined to its caller? * something else? Any direction is greatly appreciated! Many thanks! -Erick On Sat, 21 May 2022 at 00:13, Martin Jambor wrote: > Hello, > > On Fri, May 20 2022, Erick Ochoa via Gcc wrote: > > Hi, > > > > I'm working on a pass that looks into the estimated values during ipa-cp > > and stores them for a later analyses/pass. I would like to store the real > > arguments' estimates in a cgraph_edge::call_stmt or somewhere else that > > makes similar sense. (Note, this is different from the formal parameters' > > estimates which can be found in the lattice print out of ipa-cp). > > the statement is not the right place to store such pass-specific > information, for reasons you described and more (especially simple > memory use efficiency). > > Instead they should be placed into an "edge summary" (also sometimes > called "call summary"), a structure similar to ipa_edge_args_sum (in > ipa-prop.h and ipa-prop.cc). Unlike ipa_edge_args_sum, which is > allocated at analysis phase, then streamed out and in in case of LTO, > and used thrown away during the IPA analysis phase, your summary would > need to be allocated at IPA analysis time, then streamed out in > ipcp_write_transformation_summaries, streamed in in > ipcp_read_transformation_summaries so that they can be used in the > transformation phase. > > Usually a simple implementation of the duplication hook of an edge > summary is enough for the data to survive cloning and inlining and the > like. > > Martin >