[-fcompare-debug] var tracking options are not optimization options

Richard Biener richard.guenther@gmail.com
Wed Jan 4 11:36:00 GMT 2017


On Tue, Jan 3, 2017 at 6:29 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> If we include them in the ICF hash, they may cause congruence_groups to
> be processed in a different order due to different hashes, which in turn
> causes different funcdef_nos to be assigned to functions.  Since these
> numbers are included in -fcompare-debug dumps, they cause failures.

Is this because ICF simply compares all optimize/target options?

So it boils down to -g implying -fvar-tracking but -g0 not?  Maybe we need a
third state then ("default")?

> Since these options are not optimization options, in that they do not
> (or should not, save for bugs like this) affect the executable code
> output by the compiler, they should not be marked as such.
>
> This patch removes the Optimization marker from the var-tracking
> options, and adjusts the code that uses these flags to match.
>
> This fixes -fcompare-debug failures in numerous LTO testcases.
>
> Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  OK to install?

I don't think this is ok -- 'Optimization' doesn't really mean optimization
but sth we can control per-function.  You essentially remove the ability
to disable var-tracking just for a single (bad) function.

Richard.

> for  gcc/ChangeLog
>
>         * common.opt (fvar-tracking): Drop Optimization flag.
>         (fvar-tracking-assignments): Likewise.
>         (fvar-tracking-assignments-toggle): Likewise.
>         (fvar-tracking-uninit): Likewise.
>         * tree-inline.c (insert_debug_decl_map): Adjust uses of
>         flag_var_tracking_assignments.
>         (remap_gimple_stmt): Likewise.
>         (insert_init_debug_bind): Likewise.
>         (reset_debug_bindings): Likewise.
> ---
>  gcc/common.opt    |    8 ++++----
>  gcc/tree-inline.c |    9 ++++-----
>  2 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 6ebaf9c..c4aad6f 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -2644,7 +2644,7 @@ Common Undocumented Var(flag_use_linker_plugin)
>  ; will be set according to optimize, debug_info_level and debug_hooks
>  ; in process_options ().
>  fvar-tracking
> -Common Report Var(flag_var_tracking) Init(2) Optimization
> +Common Report Var(flag_var_tracking) Init(2)
>  Perform variable tracking.
>
>  ; Positive if we should track variables at assignments, negative if
> @@ -2652,13 +2652,13 @@ Perform variable tracking.
>  ; annotations.  When flag_var_tracking_assignments ==
>  ; AUTODETECT_VALUE it will be set according to flag_var_tracking.
>  fvar-tracking-assignments
> -Common Report Var(flag_var_tracking_assignments) Init(2) Optimization
> +Common Report Var(flag_var_tracking_assignments) Init(2)
>  Perform variable tracking by annotating assignments.
>
>  ; Nonzero if we should toggle flag_var_tracking_assignments after
>  ; processing options and computing its default.  */
>  fvar-tracking-assignments-toggle
> -Common Report Var(flag_var_tracking_assignments_toggle) Optimization
> +Common Report Var(flag_var_tracking_assignments_toggle)
>  Toggle -fvar-tracking-assignments.
>
>  ; Positive if we should track uninitialized variables, negative if
> @@ -2666,7 +2666,7 @@ Toggle -fvar-tracking-assignments.
>  ; annotations.  When flag_var_tracking_uninit == AUTODETECT_VALUE it
>  ; will be set according to flag_var_tracking.
>  fvar-tracking-uninit
> -Common Report Var(flag_var_tracking_uninit) Optimization
> +Common Report Var(flag_var_tracking_uninit)
>  Perform variable tracking and also tag variables that are uninitialized.
>
>  ftree-vectorize
> diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> index 0de0b89..19ef5ee 100644
> --- a/gcc/tree-inline.c
> +++ b/gcc/tree-inline.c
> @@ -156,7 +156,7 @@ insert_debug_decl_map (copy_body_data *id, tree key, tree value)
>    if (!gimple_in_ssa_p (id->src_cfun))
>      return;
>
> -  if (!opt_for_fn (id->dst_fn, flag_var_tracking_assignments))
> +  if (!flag_var_tracking_assignments)
>      return;
>
>    if (!target_for_debug_bind (key))
> @@ -1376,8 +1376,7 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
>    bool skip_first = false;
>    gimple_seq stmts = NULL;
>
> -  if (is_gimple_debug (stmt)
> -      && !opt_for_fn (id->dst_fn, flag_var_tracking_assignments))
> +  if (is_gimple_debug (stmt) && !flag_var_tracking_assignments)
>      return stmts;
>
>    /* Begin by recognizing trees that we'll completely rewrite for the
> @@ -3046,7 +3045,7 @@ insert_init_debug_bind (copy_body_data *id,
>    if (!gimple_in_ssa_p (id->src_cfun))
>      return NULL;
>
> -  if (!opt_for_fn (id->dst_fn, flag_var_tracking_assignments))
> +  if (!flag_var_tracking_assignments)
>      return NULL;
>
>    tracked_var = target_for_debug_bind (var);
> @@ -4379,7 +4378,7 @@ reset_debug_bindings (copy_body_data *id, gimple_stmt_iterator gsi)
>    if (!gimple_in_ssa_p (id->src_cfun))
>      return;
>
> -  if (!opt_for_fn (id->dst_fn, flag_var_tracking_assignments))
> +  if (!flag_var_tracking_assignments)
>      return;
>
>    for (var = DECL_ARGUMENTS (id->src_fn);
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer



More information about the Gcc-patches mailing list