LTO : question about get_untransformed_body

Erick Ochoa erick.ochoa@theobroma-systems.com
Wed Dec 4 17:03:00 GMT 2019



On 2019-12-04 7:52 a.m., Richard Biener wrote:
> On Tue, Dec 3, 2019 at 11:51 PM Erick Ochoa
> <erick.ochoa@theobroma-systems.com> wrote:
>>
>> Hi,
>>
>> I am trying to use the function: `cgraph_node::get_untransformed_body` during
>> the wpa stage of a SIMPLE_IPA_PASS transformation. While the execute function
> 
> I think SIMPLE_IPA_PASSes have no "WPA" stage but run at LTRANS time
> (WPA transform stage).  So you might simply see that not all bodies are
> available in your LTRANS unit?
> 

This makes a lot of sense, and it is indeed documented in the GCC internals
manual:

  A small inter-procedural pass (SIMPLE_IPA_PASS) is a pass that does
  everything at once and thus it can not be executed during WPA in WHOPR
  mode. It defines only the Execute stage and during this stage it
  accesses and modifies the function bodies. Such passes are useful for
  optimization at LGEN or LTRANS time and are used, for example, to
  implement early optimization before writing object files.

I got confused because the dump_file for my pass includes the substring 'wpa'.
Should I file a bug to change the name of the dumpfile to something more like
`ltrans*`?

Thanks for your help!

>> is running, I need to access the body of a function in order to iterate over
>> the gimple instructions in the first basic block. I have found that the
>> majority of the cgraph_node will return successfully. However, there are some
>> functions which consistently produce a segmentation fault following this
>> stacktrace:
>>
>> ```
>> 0xbc2adb crash_signal
>> /home/eochoa/code/gcc/gcc/toplev.c:328
>> 0xa54858 lto_get_decl_name_mapping(lto_file_decl_data*, char const*)
>> /home/eochoa/code/gcc/gcc/lto-section-in.c:367
>> 0x7030e7 cgraph_node::get_untransformed_body()
>> /home/eochoa/code/gcc/gcc/cgraph.c:3516
>> 0x150613f get_bb1_callees
>> /home/eochoa/code/gcc/gcc/ipa-initcall-cp.c:737
>> 0x150613f reach_nodes_via_bb1_dfs
>> ```
>>
>> Is there a way for `cgraph_node::get_untransformed_body` to succeed
>> consistently? (I.e. are there some preconditions that I need to make sure are
>> in place before calling cgraph_node::get_untransformed_body?
>>
>> I am using gcc version 10.0.0 20191127 (experimental)
>>
>> Thanks



More information about the Gcc mailing list