diff options
Diffstat (limited to 'gcc/opts.cc')
-rw-r--r-- | gcc/opts.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/opts.cc b/gcc/opts.cc index 80c7a97..5e7b77d 100644 --- a/gcc/opts.cc +++ b/gcc/opts.cc @@ -1037,6 +1037,25 @@ report_conflicting_sanitizer_options (struct gcc_options *opts, location_t loc, } } +/* Validate from OPTS and OPTS_SET that when -fipa-reorder-for-locality is + enabled no explicit -flto-partition is also passed as the locality cloning + pass uses its own partitioning scheme. */ + +static void +validate_ipa_reorder_locality_lto_partition (struct gcc_options *opts, + struct gcc_options *opts_set) +{ + static bool validated_p = false; + + if (opts->x_flag_lto_partition != LTO_PARTITION_DEFAULT) + { + if (opts_set->x_flag_ipa_reorder_for_locality && !validated_p) + error ("%<-fipa-reorder-for-locality%> is incompatible with" + " an explicit %qs option", "-flto-partition"); + } + validated_p = true; +} + /* After all options at LOC have been read into OPTS and OPTS_SET, finalize settings of those options and diagnose incompatible combinations. */ @@ -1249,6 +1268,10 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, if (opts->x_flag_reorder_blocks_and_partition) SET_OPTION_IF_UNSET (opts, opts_set, flag_reorder_functions, 1); + validate_ipa_reorder_locality_lto_partition (opts, opts_set); + if (opts_set->x_flag_lto_partition != LTO_PARTITION_DEFAULT) + opts_set->x_flag_lto_partition = opts->x_flag_lto_partition = LTO_PARTITION_BALANCED; + /* The -gsplit-dwarf option requires -ggnu-pubnames. */ if (opts->x_dwarf_split_debug_info) opts->x_debug_generate_pub_sections = 2; |