From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1035) id 1125C3855034; Mon, 23 Aug 2021 14:40:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1125C3855034 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Earnshaw To: gcc-cvs@gcc.gnu.org Subject: [gcc r9-9689] arm: Don't reconfigure globals in arm_configure_build_target X-Act-Checkin: gcc X-Git-Author: Richard Earnshaw X-Git-Refname: refs/heads/releases/gcc-9 X-Git-Oldrev: 140a8089000ffa340b2f188be8abec134f1b888f X-Git-Newrev: 9a48ce5c29158af88c0b98a97f5336c0896394a5 Message-Id: <20210823144058.1125C3855034@sourceware.org> Date: Mon, 23 Aug 2021 14:40:58 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2021 14:40:58 -0000 https://gcc.gnu.org/g:9a48ce5c29158af88c0b98a97f5336c0896394a5 commit r9-9689-g9a48ce5c29158af88c0b98a97f5336c0896394a5 Author: Richard Earnshaw Date: Tue Jul 27 15:44:57 2021 +0100 arm: Don't reconfigure globals in arm_configure_build_target arm_configure_build_target is usually used to reconfigure the arm_active_target structure, which is then used to reconfigure a number of other global variables describing the current target. Occasionally, however, we need to use arm_configure_build_target to construct a temporary target structure and in that case it is wrong to try to reconfigure the global variables (although probably harmless, since arm_option_reconfigure_globals() only looks at arm_active_target). At the very least, however, this is wasted work, so it is best not to do it unless needed. What's more, several callers of arm_configure_build target call arm_option_reconfigure_globals themselves within a few lines, making the call from within arm_configure_build_target completely redundant. So this patch moves the responsibility of calling of arm_configure_build_target to its callers (only two places needed updating). gcc: * config/arm/arm.c (arm_configure_build_target): Don't call arm_option_reconfigure_globals. (arm_option_restore): Call arm_option_reconfigure_globals after reconfiguring the target. * config/arm/arm-c.c (arm_pragma_target_parse): Likewise. (cherry picked from commit 6a37d0331c25f23628d4308e5a75624005c223b2) Diff: --- gcc/config/arm/arm-c.c | 1 + gcc/config/arm/arm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/config/arm/arm-c.c b/gcc/config/arm/arm-c.c index 38da34203d0..8cb08646ce5 100644 --- a/gcc/config/arm/arm-c.c +++ b/gcc/config/arm/arm-c.c @@ -267,6 +267,7 @@ arm_pragma_target_parse (tree args, tree pop_target) target_option_current_node = cur_tree; arm_configure_build_target (&arm_active_target, TREE_TARGET_OPTION (cur_tree), false); + arm_option_reconfigure_globals (); } /* Update macros if target_node changes. The global state will be restored diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 4685fd88327..f4ed21ebb50 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3007,6 +3007,7 @@ arm_option_restore (struct gcc_options *opts, struct cl_target_option *ptr) opts->x_arm_cpu_string = ptr->x_arm_cpu_string; opts->x_arm_tune_string = ptr->x_arm_tune_string; arm_configure_build_target (&arm_active_target, ptr, false); + arm_option_reconfigure_globals (); } /* Reset options between modes that the user has specified. */ @@ -3366,7 +3367,6 @@ arm_configure_build_target (struct arm_build_target *target, target->tune_flags = tune_data->tune_flags; target->tune = tune_data->tune; target->tune_core = tune_data->scheduler; - arm_option_reconfigure_globals (); } /* Fix up any incompatible options that the user has specified. */