From patchwork Thu May 16 06:22:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongyu Wang X-Patchwork-Id: 1935811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UdmM2R9P; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vg0Sz0FcSz1ydW for ; Thu, 16 May 2024 16:25:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61CC9384AB7B for ; Thu, 16 May 2024 06:25:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by sourceware.org (Postfix) with ESMTPS id 05BD9384CB97 for ; Thu, 16 May 2024 06:24:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 05BD9384CB97 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 05BD9384CB97 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.12 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715840702; cv=none; b=Bp9XcHPkSwStFIoadkhaA/PQ01vmGxxLcHeGgqQhMICduBiwAEyYel8L+e+Mjmlgkv7TWHrJSD62P3eiK+JJYM6xBYTTFpuIbqfj8DxxM2TINMcKRxH5Sbn1LCZmsZX66nf5hgFz4m1MbT8ekmmFT2rwabrFhDmEXtDK8wY5Z8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715840702; c=relaxed/simple; bh=3XaE379GPYJxqY6JIQKAhnZ6+9pDBhxRa81SOroUttk=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=DApK2Xu4TjmTo/ciOithLd4huVFQW5BBhj5HrVPCPnnu4ZlKrDqn3fasMvTGHAMQuYgLdOJDKaU2yLDIR8hvHmJzH0QLcmb1CKyl67XjSOvYcqrlyhEM9zApohVoc8FLFuPU2Ntdy885/Hz1nfu8NkZqoZwDh8cIPAsacX3x7Ak= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1715840700; x=1747376700; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=3XaE379GPYJxqY6JIQKAhnZ6+9pDBhxRa81SOroUttk=; b=UdmM2R9PAWxw30Iy7SqbsSo0Y5ZV1tOIIbFMvGIlIe8JInEC8PSdAHui QN4/jO4jwkMdSbOYxsHdlztZ3KWT+jnR7m5fOVdUfXetiSru8f6bP2C1Z YFYYIbqp8NvSlhAda5JdCAom6551+61La7rhEvj/rS7Rc9I/MYENCW+yU aWzuCCCApPFd/l1WuYeFtlopsWeqcmCMx3y9idHzJufPbVHhFWxKN+VMr AB08mmAguOu71mBYGJZS/7GC7lsCW6h+jl3EvECzR6M7LsOU7lPAgzPz6 ewxF4aqDtrMq8MAZb9rUYPswMnSB3p4BCI/OffS8DEuq6d/yQWXJbvFBE A==; X-CSE-ConnectionGUID: QVVCEmoVQPKWFsV+DM86NQ== X-CSE-MsgGUID: 8VexMwo9SpSmvJQrmSUSSQ== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="23331275" X-IronPort-AV: E=Sophos;i="6.08,163,1712646000"; d="scan'208";a="23331275" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2024 23:24:59 -0700 X-CSE-ConnectionGUID: 38jEnffgTpaOCBieumR9Tw== X-CSE-MsgGUID: a4V9vBQuRf2QgQMwc0HU0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,163,1712646000"; d="scan'208";a="31311490" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmviesa008.fm.intel.com with ESMTP; 15 May 2024 23:24:57 -0700 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 878771008F74; Thu, 16 May 2024 14:24:56 +0800 (CST) From: Hongyu Wang To: gcc-patches@gcc.gnu.org Cc: hongtao.liu@intel.com, ubizjak@gmail.com Subject: [PATCH] i386: Fix ix86_option override after change [PR 113719] Date: Thu, 16 May 2024 14:22:56 +0800 Message-Id: <20240516062256.4144064-1-hongyu.wang@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, In ix86_override_options_after_change, calls to ix86_default_align and ix86_recompute_optlev_based_flags will cause mismatched target opt_set when doing cl_optimization_restore. Move them back to ix86_option_override_internal to solve the issue. Bootstrapped & regtested on x86_64-pc-linux-gnu, and Rainer helped to test with i386-pc-solaris2.11 which also passed 32/64bit tests. Ok for trunk and backport down to gcc12? gcc/ChangeLog: PR target/113719 * config/i386/i386-options.cc (ix86_override_options_after_change): Remove call to ix86_default_align and ix86_recompute_optlev_based_flags. (ix86_option_override_internal): Call ix86_default_align and ix86_recompute_optlev_based_flags. --- gcc/config/i386/i386-options.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index ac48b5c61c4..d97464f2c74 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -1930,11 +1930,6 @@ ix86_recompute_optlev_based_flags (struct gcc_options *opts, void ix86_override_options_after_change (void) { - /* Default align_* from the processor table. */ - ix86_default_align (&global_options); - - ix86_recompute_optlev_based_flags (&global_options, &global_options_set); - /* Disable unrolling small loops when there's explicit -f{,no}unroll-loop. */ if ((OPTION_SET_P (flag_unroll_loops)) @@ -2530,6 +2525,8 @@ ix86_option_override_internal (bool main_args_p, set_ix86_tune_features (opts, ix86_tune, opts->x_ix86_dump_tunes); + ix86_recompute_optlev_based_flags (opts, opts_set); + ix86_override_options_after_change (); ix86_tune_cost = processor_cost_table[ix86_tune]; @@ -2565,6 +2562,9 @@ ix86_option_override_internal (bool main_args_p, || TARGET_64BIT_P (opts->x_ix86_isa_flags)) opts->x_ix86_regparm = REGPARM_MAX; + /* Default align_* from the processor table. */ + ix86_default_align (&global_options); + /* Provide default for -mbranch-cost= value. */ SET_OPTION_IF_UNSET (opts, opts_set, ix86_branch_cost, ix86_tune_cost->branch_cost);