On Mon, Nov 03 2025, ywgrit via Gcc wrote:
> I wrote an IPA PASS in the plugin: ipa-get_fun. This IPA PASS is placed
> before ipa-inline. The `generate_summary`, `write_summary`, `read_summary`,
> `write_optimization_summary`, and `read_optimization_summary` functions in
> `ipa-get_fun` do nothing—they are empty. In the `execute` function of the
> WPA phase for `ipa-get_fun`, only the following code exists: it retrieves
> the function bodies for each function. cgraph_node *n;
> cgraph_node *n;
> FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (n)
> {
> if (n && n->decl)
> {
> n->get_untransformed_body ();
> }
> }
>
>
> Immediately afterward, within the execute function of the WPA phase in
> IPA-inline, estimate_calls_size_and_time was invoked. The following segment
> of code in estimate_calls_size_and_time encountered an assertion error.
> estimate_calls_size_and_time_1 (node, &old_size, NULL, &old_time, NULL,
> possible_truths, avals);
> gcc_assert (*size == old_size);
>
>
> In this case, *size == 20 and old_size == 14. Why is this happening, and
> can I access the function body in this manner within the execute function
> of a WPA phase in an IPA PASS?
IPA-ICF uses it to get at the body of functions it needs to compare in
detail (when hashes generated in generate_summary match), so it can be
used. But in order to scale, it should only be used seldomly, in
special circumstances.
In any case I'm afraid that you'll need to debug yourself why you are
hitting the assert, why the size estimate differs.. I think it should
not happen though.
Martin