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 <int, va_gc> *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 <mjam...@suse.cz> 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 >