Hi,

On Fri, Mar 26 2021, Erick Ochoa via Gcc wrote:
> I already have some experience developing SIMPLE_IPA_PASSes, but I am
> looking to understand IPA_PASSes better. I have made a hello world ipa
> pass that stores "hello world $FUNCTION_NAME" in the function
> summaries; however, I am having trouble reading this information back.
> Can someone help me understand how to use these interfaces correctly?
>
> At the moment, it **seems** to be writing information correctly.
> (I.e., it doesn't segfault when attempting to write data.) However, in
> my read summary function (ipa_hello_world_read_summary (void)) the
> function `lto_get_summary_section_data (file_data,
> LTO_section_ipa_hello_world, &len);` always returns NULL and
> `file_data_vec` is of size 1. This means that at run time, there is
> only one call to `lto_get_summary_section_data` and it returns NULL.

I looked at the code you posted and compared it with streaming in
ipa-sra.c and did not spot any difference that could result in this
behavior.

I guess you have checked that the functions are called from proper
hooks?  (I.e. from write_summary and read_summary or
write_optimization_summary and read_optimization_summary, depending on
what you are trying to do, and not some mixture of these combinations?)

You can try and send the whole patch (hopefully a hello world pass would
not be too large) and I can have a look.

Martin

Reply via email to