diff mbox series

Mark param_max_fields_for_field_sensitive with Optimization keyword.

Message ID 505b5acb-d240-6e68-cc3d-c8b25fd92a6c@suse.cz
State New
Headers show
Series Mark param_max_fields_for_field_sensitive with Optimization keyword. | expand

Commit Message

Martin Liška Jan. 3, 2020, 12:26 p.m. UTC
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  <mliska@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(-)

Comments

Jeff Law Jan. 6, 2020, 4:41 p.m. UTC | #1
On Fri, 2020-01-03 at 13:26 +0100, Martin Liška wrote:
> 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  <mliska@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(-)
> 
> 
OK
jeff
Richard Biener Jan. 7, 2020, 12:51 p.m. UTC | #2
On Fri, Jan 3, 2020 at 1:26 PM Martin Liška <mliska@suse.cz> wrote:
>
> 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?

As said in the PR this looks wrong, possibly leading to wrong code.

Richard.

> Thanks,
> Martin
>
> gcc/ChangeLog:
>
> 2020-01-03  Martin Liska  <mliska@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 mbox series

Patch

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);