aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <ktkachov@nvidia.com>2025-04-24 00:34:09 -0700
committerKyrylo Tkachov <ktkachov@nvidia.com>2025-04-24 13:59:21 +0200
commit040f94d1f63c3607a2f3faf5c329c3b2b6bf7d1e (patch)
treeeaf669a47b3e4252dcd973ed27d9e82ac9b68bec /gcc
parent7a4f7a92770db4e739e76a06175454ba38d60b22 (diff)
downloadgcc-040f94d1f63c3607a2f3faf5c329c3b2b6bf7d1e.zip
gcc-040f94d1f63c3607a2f3faf5c329c3b2b6bf7d1e.tar.gz
gcc-040f94d1f63c3607a2f3faf5c329c3b2b6bf7d1e.tar.bz2
opts.cc Simplify handling of explicit -flto-partition= and -fipa-reorder-for-locality
The handling of an explicit -flto-partition= and -fipa-reorder-for-locality should be simpler. No need to have a new default option. We can use opts_set to check if -flto-partition is explicitly set and use that information in the error handling. Remove -flto-partition=default and update accordingly. Bootstrapped and tested on aarch64-none-linux-gnu. Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com> gcc/ * common.opt (LTO_PARTITION_DEFAULT): Delete. (flto-partition=): Change default back to balanced. * flag-types.h (lto_partition_model): Remove LTO_PARTITION_DEFAULT. * opts.cc (validate_ipa_reorder_locality_lto_partition): Check opts_set->x_flag_lto_partition instead of LTO_PARTITION_DEFAULT. (finish_options): Remove handling of LTO_PARTITION_DEFAULT. gcc/testsuite/ * gcc.dg/completion-2.c: Remove check for default.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/common.opt5
-rw-r--r--gcc/flag-types.h3
-rw-r--r--gcc/opts.cc11
-rw-r--r--gcc/testsuite/gcc.dg/completion-2.c1
4 files changed, 6 insertions, 14 deletions
diff --git a/gcc/common.opt b/gcc/common.opt
index 88d987e..e3fa0da 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2279,9 +2279,6 @@ Enum
Name(lto_partition_model) Type(enum lto_partition_model) UnknownError(unknown LTO partitioning model %qs)
EnumValue
-Enum(lto_partition_model) String(default) Value(LTO_PARTITION_DEFAULT)
-
-EnumValue
Enum(lto_partition_model) String(none) Value(LTO_PARTITION_NONE)
EnumValue
@@ -2300,7 +2297,7 @@ EnumValue
Enum(lto_partition_model) String(cache) Value(LTO_PARTITION_CACHE)
flto-partition=
-Common Joined RejectNegative Enum(lto_partition_model) Var(flag_lto_partition) Init(LTO_PARTITION_DEFAULT)
+Common Joined RejectNegative Enum(lto_partition_model) Var(flag_lto_partition) Init(LTO_PARTITION_BALANCED)
Specify the algorithm to partition symbols and vars at linktime.
; The initial value of -1 comes from Z_DEFAULT_COMPRESSION in zlib.h.
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index db57376..9a3cc4a 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -404,8 +404,7 @@ enum lto_partition_model {
LTO_PARTITION_BALANCED = 2,
LTO_PARTITION_1TO1 = 3,
LTO_PARTITION_MAX = 4,
- LTO_PARTITION_CACHE = 5,
- LTO_PARTITION_DEFAULT= 6
+ LTO_PARTITION_CACHE = 5
};
/* flag_lto_locality_cloning initialization values. */
diff --git a/gcc/opts.cc b/gcc/opts.cc
index 5e7b77d..5480b9d 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -1037,17 +1037,16 @@ report_conflicting_sanitizer_options (struct gcc_options *opts, location_t loc,
}
}
-/* Validate from OPTS and OPTS_SET that when -fipa-reorder-for-locality is
+/* Validate from 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)
+validate_ipa_reorder_locality_lto_partition (struct gcc_options *opts_set)
{
static bool validated_p = false;
- if (opts->x_flag_lto_partition != LTO_PARTITION_DEFAULT)
+ if (opts_set->x_flag_lto_partition)
{
if (opts_set->x_flag_ipa_reorder_for_locality && !validated_p)
error ("%<-fipa-reorder-for-locality%> is incompatible with"
@@ -1268,9 +1267,7 @@ 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;
+ validate_ipa_reorder_locality_lto_partition (opts_set);
/* The -gsplit-dwarf option requires -ggnu-pubnames. */
if (opts->x_dwarf_split_debug_info)
diff --git a/gcc/testsuite/gcc.dg/completion-2.c b/gcc/testsuite/gcc.dg/completion-2.c
index 46c511c..99e6531 100644
--- a/gcc/testsuite/gcc.dg/completion-2.c
+++ b/gcc/testsuite/gcc.dg/completion-2.c
@@ -5,7 +5,6 @@
-flto-partition=1to1
-flto-partition=balanced
-flto-partition=cache
--flto-partition=default
-flto-partition=max
-flto-partition=none
-flto-partition=one