diff options
author | Jan Hubicka <jh@suse.cz> | 2020-09-26 08:12:44 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-09-26 08:12:44 +0200 |
commit | b89e4559950c79d8933013305c19d7014a39cdb1 (patch) | |
tree | b669a4d78420aed0632b161bf8ff2cb1cead65c8 /gcc/ipa-predicate.h | |
parent | 5a90a18668fef8d51e5b3fe9f69123f53cbd8f25 (diff) | |
download | gcc-b89e4559950c79d8933013305c19d7014a39cdb1.zip gcc-b89e4559950c79d8933013305c19d7014a39cdb1.tar.gz gcc-b89e4559950c79d8933013305c19d7014a39cdb1.tar.bz2 |
Track arguments pointing to local or readonly memory in ipa-fnsummary
this patch implement tracking wehther argument points to readonly memory. This
is is useful for ipa-modref as well as for inline heuristics. It is desirable
to inline functions that dereference pointers to local variables in order
to support SRA. We always did the oposite heuristics (guessing that the
dereferences will be optimized out with 50% probability) but here we could
increase the probability for cases where we can track that argument is indeed
a local memory (or readonly which is also good)
* ipa-fnsummary.c (dump_ipa_call_summary): Dump
points_to_local_or_readonly_memory flag.
(analyze_function_body): Compute points_to_local_or_readonly_memory
flag.
(remap_edge_change_prob): Rename to ...
(remap_edge_params): ... this one; update
points_to_local_or_readonly_memory.
(remap_edge_summaries): Update.
(read_ipa_call_summary): Stream the new flag.
(write_ipa_call_summary): Likewise.
* ipa-predicate.h (struct inline_param_summary): Add
points_to_local_or_readonly_memory.
(inline_param_summary::equal_to): Update.
(inline_param_summary::useless_p): Update.
Diffstat (limited to 'gcc/ipa-predicate.h')
-rw-r--r-- | gcc/ipa-predicate.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ipa-predicate.h b/gcc/ipa-predicate.h index 9b75ffc..05e3707 100644 --- a/gcc/ipa-predicate.h +++ b/gcc/ipa-predicate.h @@ -76,14 +76,18 @@ struct inline_param_summary parameters REG_BR_PROB_BASE. Value 0 is reserved for compile time invariants. */ - int change_prob; + short change_prob; + unsigned points_to_local_or_readonly_memory : 1; bool equal_to (const inline_param_summary &other) const { - return change_prob == other.change_prob; + return change_prob == other.change_prob + && points_to_local_or_readonly_memory + == other.points_to_local_or_readonly_memory; } bool useless_p (void) const { - return change_prob == REG_BR_PROB_BASE; + return change_prob == REG_BR_PROB_BASE + && !points_to_local_or_readonly_memory; } }; |