[-fcompare-debug] var tracking options are not optimization options
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. 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 replaces the Optimization flag in the var-tracking options with the newly-introduced PerFunction flag, so that it can still be controlled on a per-function basis, but that disregards it in the hash computation used by ICF. This fixes -fcompare-debug failures in numerous LTO testcases. for gcc/ChangeLog * doc/options.texi (PerFunction): New. * opt-functions.awk (switch_flags): Map both Optimization and PerFunction to CL_OPTIMIZATION. * opth-gen.awk: Test for PerFunction flag along with Optimization. * optc-save-gen.awk: Likewise. Introduce var_opt_hash and set it only when the latter is present. Skip those that don't in the hash function generator. * common.opt (fvar-tracking): Mark as PerFunction instead of Optimization. (fvar-tracking-assignments): Likewise. (fvar-tracking-assignments-toggle): Likewise. (fvar-tracking-uninit): Likewise. From-SVN: r244198
This commit is contained in:
parent
42002dfec3
commit
ff98fa955b
6 changed files with 34 additions and 8 deletions
|
@ -1,3 +1,19 @@
|
|||
2017-01-07 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* doc/options.texi (PerFunction): New.
|
||||
* opt-functions.awk (switch_flags): Map both Optimization and
|
||||
PerFunction to CL_OPTIMIZATION.
|
||||
* opth-gen.awk: Test for PerFunction flag along with
|
||||
Optimization.
|
||||
* optc-save-gen.awk: Likewise. Introduce var_opt_hash and set
|
||||
it only when the latter is present. Skip those that don't in
|
||||
the hash function generator.
|
||||
* common.opt (fvar-tracking): Mark as PerFunction instead of
|
||||
Optimization.
|
||||
(fvar-tracking-assignments): Likewise.
|
||||
(fvar-tracking-assignments-toggle): Likewise.
|
||||
(fvar-tracking-uninit): Likewise.
|
||||
|
||||
2017-01-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR translation/79018
|
||||
|
|
|
@ -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) PerFunction
|
||||
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) PerFunction
|
||||
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) PerFunction
|
||||
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) PerFunction
|
||||
Perform variable tracking and also tag variables that are uninitialized.
|
||||
|
||||
ftree-vectorize
|
||||
|
|
|
@ -430,6 +430,13 @@ This is an optimization option. It should be shown as such in
|
|||
@code{Var} should be saved and restored when the optimization level is
|
||||
changed with @code{optimize} attributes.
|
||||
|
||||
@item PerFunction
|
||||
This is an option that can be overridden on a per-function basis.
|
||||
@code{Optimization} implies @code{PerFunction}, but options that do not
|
||||
affect executable code generation may use this flag instead, so that the
|
||||
option is not taken into account in ways that might affect executable
|
||||
code generation.
|
||||
|
||||
@item Undocumented
|
||||
The option is deliberately missing documentation and should not
|
||||
be included in the @option{--help} output.
|
||||
|
|
|
@ -105,7 +105,7 @@ function switch_flags (flags)
|
|||
test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \
|
||||
test_flag("NoDWARFRecord", flags, " | CL_NO_DWARF_RECORD") \
|
||||
test_flag("Warning", flags, " | CL_WARNING") \
|
||||
test_flag("Optimization", flags, " | CL_OPTIMIZATION")
|
||||
test_flag("(Optimization|PerFunction)", flags, " | CL_OPTIMIZATION")
|
||||
sub( "^0 \\| ", "", result )
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ var_opt_range["optimize_debug"] = "0, 1";
|
|||
# cache.
|
||||
|
||||
for (i = 0; i < n_opts; i++) {
|
||||
if (flag_set_p("Optimization", flags[i])) {
|
||||
if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
|
||||
name = var_name(flags[i])
|
||||
if(name == "")
|
||||
continue;
|
||||
|
@ -743,7 +743,7 @@ var_opt_val[2] = "x_optimize_debug"
|
|||
var_opt_val_type[1] = "char "
|
||||
var_opt_val_type[2] = "char "
|
||||
for (i = 0; i < n_opts; i++) {
|
||||
if (flag_set_p("Optimization", flags[i])) {
|
||||
if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
|
||||
name = var_name(flags[i])
|
||||
if(name == "")
|
||||
continue;
|
||||
|
@ -756,6 +756,7 @@ for (i = 0; i < n_opts; i++) {
|
|||
otype = var_type_struct(flags[i])
|
||||
var_opt_val_type[n_opt_val] = otype;
|
||||
var_opt_val[n_opt_val++] = "x_" name;
|
||||
var_opt_hash[n_opt_val] = flag_set_p("Optimization", flags[i]);
|
||||
}
|
||||
}
|
||||
print "";
|
||||
|
@ -765,6 +766,8 @@ print "cl_optimization_hash (struct cl_optimization const *ptr ATTRIBUTE_UNUSED)
|
|||
print "{";
|
||||
print " inchash::hash hstate;";
|
||||
for (i = 0; i < n_opt_val; i++) {
|
||||
if (!var_opt_hash[i])
|
||||
continue;
|
||||
name = var_opt_val[i]
|
||||
print " hstate.add_wide_int (ptr->" name");";
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ var_opt_char[1] = "unsigned char x_optimize_size";
|
|||
var_opt_char[2] = "unsigned char x_optimize_debug";
|
||||
|
||||
for (i = 0; i < n_opts; i++) {
|
||||
if (flag_set_p("Optimization", flags[i])) {
|
||||
if (flag_set_p("(Optimization|PerFunction)", flags[i])) {
|
||||
name = var_name(flags[i])
|
||||
if(name == "")
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue