From patchwork Thu Oct 10 14:01:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1174568 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510626-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="MnpBdYln"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46pt6X4cPCz9sDQ for ; Fri, 11 Oct 2019 01:01:22 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=QS4ctkhNHPJJf3jid3gyinsRdUJi7vixsgmamcdp+RdjQktDlPErN YmRcFoNbbEKwCAJWP3KAIX/lXGkp+FOtwg59JsxKHg9lgWS1XWraL3hBZesXLc/q 34FO36UmYxFJjzdybjthDRfLnPwtMMz7Wyb7HlLBIVZ2YfgQu34FqM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=WpnARq+Vg043FNEsBvtFFHwg4cE=; b=MnpBdYlnhGFIvs1i5VlI mFMK4VkQzeRoE/vE6eDcsbSkdUmsooPaot7v4e/TW8VKg+VNCoOslkkLp9GjlkeH BffopKIGOIh2oO4xykf2czpicePuMdq9V2kvKQyblEP5DWXtZbsbvdrPLiR0A/vj GNloJM/iy1U3G2GsNBcO1bA= Received: (qmail 111409 invoked by alias); 10 Oct 2019 14:01:15 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 111400 invoked by uid 89); 10 Oct 2019 14:01:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=20758 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2019 14:01:09 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 42174B1BB for ; Thu, 10 Oct 2019 14:01:07 +0000 (UTC) Date: Thu, 10 Oct 2019 16:01:07 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92046 Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 The following fixes a few param adjustments that are made based on per-function adjustable flags by moving the adjustments to their users. Semantics change in some minor ways but that's allowed for --params. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2019-10-10 Richard Biener PR middle-end/92046 * opts.c (finish_options): Do not influence global --params from options that are adjustable per function. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Apply --param adjustment based on active cost-model. * tree-ssa-phiopt.c (cond_if_else_store_replacement): Disable further store-sinking when vectorization or if-conversion are not enabled. Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 276795)+++ gcc/opts.c (working copy) +++ gcc/opts.c (working copy) @@ -1123,24 +1123,6 @@ finish_options (struct gcc_options *opts && !opts_set->x_flag_reorder_functions) opts->x_flag_reorder_functions = 1; - /* Tune vectorization related parametees according to cost model. */ - if (opts->x_flag_vect_cost_model == VECT_COST_MODEL_CHEAP) - { - maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS, - 6, opts->x_param_values, opts_set->x_param_values); - maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS, - 0, opts->x_param_values, opts_set->x_param_values); - maybe_set_param_value (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT, - 0, opts->x_param_values, opts_set->x_param_values); - } - - /* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion - is disabled. */ - if ((!opts->x_flag_tree_loop_vectorize && !opts->x_flag_tree_slp_vectorize) - || !opts->x_flag_tree_loop_if_convert) - maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0, - opts->x_param_values, opts_set->x_param_values); - /* The -gsplit-dwarf option requires -ggnu-pubnames. */ if (opts->x_dwarf_split_debug_info) opts->x_debug_generate_pub_sections = 2; Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 276795) +++ gcc/tree-vect-data-refs.c (working copy) @@ -2075,6 +2075,8 @@ vect_enhance_data_refs_alignment (loop_v { unsigned max_allowed_peel = PARAM_VALUE (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT); + if (flag_vect_cost_model == VECT_COST_MODEL_CHEAP) + max_allowed_peel = 0; if (max_allowed_peel != (unsigned)-1) { unsigned max_peel = npeel; @@ -2168,15 +2170,16 @@ vect_enhance_data_refs_alignment (loop_v /* (2) Versioning to force alignment. */ /* Try versioning if: - 1) optimize loop for speed + 1) optimize loop for speed and the cost-model is not cheap 2) there is at least one unsupported misaligned data ref with an unknown misalignment, and 3) all misaligned data refs with a known misalignment are supported, and 4) the number of runtime alignment checks is within reason. */ - do_versioning = - optimize_loop_nest_for_speed_p (loop) - && (!loop->inner); /* FORNOW */ + do_versioning + = (optimize_loop_nest_for_speed_p (loop) + && !loop->inner /* FORNOW */ + && flag_vect_cost_model > VECT_COST_MODEL_CHEAP); if (do_versioning) { @@ -3641,13 +3644,15 @@ vect_prune_runtime_alias_test_list (loop dump_printf_loc (MSG_NOTE, vect_location, "improved number of alias checks from %d to %d\n", may_alias_ddrs.length (), count); - if ((int) count > PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS)) + unsigned limit = PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS); + if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP) + limit = default_param_value + (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS) * 6 / 10; + if (count > limit) return opt_result::failure_at (vect_location, - "number of versioning for alias " - "run-time tests exceeds %d " - "(--param vect-max-version-for-alias-checks)\n", - PARAM_VALUE (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS)); + "number of versioning for alias run-time tests exceeds %d " + "(--param vect-max-version-for-alias-checks)\n", limit); return opt_result::success (); } Index: gcc/tree-ssa-phiopt.c =================================================================== --- gcc/tree-ssa-phiopt.c (revision 276795) +++ gcc/tree-ssa-phiopt.c (working copy) @@ -2467,7 +2467,11 @@ cond_if_else_store_replacement (basic_bl then_assign, else_assign); } - if (MAX_STORES_TO_SINK == 0) + /* If either vectorization or if-conversion is disabled then do + not sink any stores. */ + if (MAX_STORES_TO_SINK == 0 + || (!flag_tree_loop_vectorize && !flag_tree_slp_vectorize) + || !flag_tree_loop_if_convert) return false; /* Find data references. */