[PATCH 3/n] ipa: Simplify interface of ipa_call_context::estimate_size_and_time

Martin Jambor mjambor@suse.cz
Sat Aug 29 20:22:01 GMT 2020


Hi,

On Sat, Aug 29 2020, Jan Hubicka wrote:
>> Hi,
>> 
>> this patch changes ipa_call_context::estimate_size_and_time to store
>> its results into member fields of the ipa_call_context class instead
>> into pointers it receives as parameters so that it can compute ore
>> stuff without cluttering the interface even further.
>> 
>> Bootstrapped and tested on x86_64-linux.  OK for master on top of the
>> previous two patches?
>
> ipa_call_context is intended to be structure holding all parameters that
> are needed to produce the estimates (size/time/hints).

even today it only "holds" the data when it resides in the RCU cache,
otherwise it points to data "owned" by the caller.  Admittedly, my first
patch makes the cache data structure separate, making ipa_class_context
only a utility for calculating the estimates - but given how all the
code is structured, it does not really work as the grand encapsulator of
all context data when passing it from a function to function.

> Adding the actual estimates there would duplicate it with cache.

The first patch in the series makes the cache items not contain
ipa_call_context directly, so in my patch series at least, the estimates
are not duplicated.

> What
> about keeping them separate and inventing ipa_call_estimates structure
> to hold the reults?

I can but unless you do not like the first patch and want me to re-write
it or just not do anything like it, I don't think it matters because the
structures will almost always lie next to each other on the user's
stack.

Martin

>> 
>> 
>> gcc/ChangeLog:
>> 
>> 2020-08-28  Martin Jambor  <mjambor@suse.cz>
>> 
>> 	* ipa-fnsummary.h (class ipa_call_context): Changed declaration of
>> 	estimate_size_and_time to accept two booleans.  Added an overload
>> 	of the method without any parameters.  New fields m_size,
>> 	m_min_size, m_time, m_nonspecialized_time and m_hints.
>> 	* ipa-cp.c (hint_time_bonus): Changed the second parameter from
>> 	just hints to a const reference to ipa_call_context.
>> 	(perform_estimation_of_a_value): Adjusted to the new interface of
>> 	ipa_call_context::estimate_size_and_time.
>> 	* ipa-fnsummary.c (ipa_call_context::estimate_size_and_time):
>> 	Modified to store results into member fields of the class.
>> 	* ipa-inline-analysis.c (do_estimate_edge_time): Adjusted to the
>> 	new interface of ipa_call_context::estimate_size_and_time.
>> 	(do_estimate_edge_size): Likewise.
>> 	(do_estimate_edge_hints): Likewise.


More information about the Gcc-patches mailing list