Hi. One another fix where -Ox sets a parameter that is not marked with Optimize keyword. Fixed by adding the keyword.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2020-01-03 Martin Liska <mli...@suse.cz> PR tree-optimization/92860 * params.opt: (param_max_fields_for_field_sensitive): Mark with Optimization keyword. * tree-ssa-structalias.c (use_field_sensitive): Make it a function. (get_constraint_for_ptr_offset): Call it. (create_variable_info_for_1): Likewise. (init_alias_vars): Do not initialize use_field_sensitive. --- gcc/params.opt | 2 +- gcc/tree-ssa-structalias.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/gcc/params.opt b/gcc/params.opt index c58a375e4c8..9c5f98f3a00 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -427,7 +427,7 @@ Common Joined UInteger Var(param_early_inliner_max_iterations) Init(1) Param The maximum number of nested indirect inlining performed by early inliner. -param=max-fields-for-field-sensitive= -Common Joined UInteger Var(param_max_fields_for_field_sensitive) Param +Common Joined UInteger Var(param_max_fields_for_field_sensitive) Param Optimization Maximum number of fields in a structure before pointer analysis treats the structure as a single variable. -param=max-fsm-thread-length= diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 22e904444f1..2617109c1da 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -197,7 +197,6 @@ And probably more. */ -static bool use_field_sensitive = true; static int in_ipa_mode = 0; /* Used for predecessor bitmaps. */ @@ -337,6 +336,14 @@ struct obstack final_solutions_obstack; Indexed directly by variable info id. */ static vec<varinfo_t> varmap; +/* Return true if the algorithm should be field sensitive. */ + +static bool +use_field_sensitive () +{ + return param_max_fields_for_field_sensitive > 1; +} + /* Return the varmap element N */ static inline varinfo_t @@ -3134,7 +3141,7 @@ get_constraint_for_ptr_offset (tree ptr, tree offset, /* If we do not do field-sensitive PTA adding offsets to pointers does not change the points-to solution. */ - if (!use_field_sensitive) + if (!use_field_sensitive ()) { get_constraint_for_rhs (ptr, results); return; @@ -6075,7 +6082,7 @@ create_variable_info_for_1 (tree decl, const char *name, bool add_id, } /* Collect field information. */ - if (use_field_sensitive + if (use_field_sensitive () && var_can_have_subvars (decl) /* ??? Force us to not use subfields for globals in IPA mode. Else we'd have to parse arbitrary initializers. */ @@ -7182,8 +7189,6 @@ init_base_vars (void) static void init_alias_vars (void) { - use_field_sensitive = (param_max_fields_for_field_sensitive > 1); - bitmap_obstack_initialize (&pta_obstack); bitmap_obstack_initialize (&oldpta_obstack); bitmap_obstack_initialize (&predbitmap_obstack);