From patchwork Fri Jan 3 12:26:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 1217317 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-516614-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="p7Qq8kj+"; 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 47q41B2cVgz9sPn for ; Fri, 3 Jan 2020 23:27:42 +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:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=DAqdB6JIVk1/3TiLhoQLvlTnuoN+0U3rRd7oT0fWcC7z4D3R8Y KulhGsSGDWeolHi08H2kbXjSGegRpMaElSTbCP2UsyL9zajfRG5tiCpy5mVndUxt XX20RkVO1fKVAHnA1d6qUnFFGkGez4Er7F+pxXZQul27JPAg2D+eWGm+Y= 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:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=1EBEwsDdV9WghxTZq6BIXd/SJEs=; b=p7Qq8kj+YfEIsOxg3WWn qB5z02xb0JwbqW+ktMsvCxVDgmdRDTPExOPJ3fw2v3wswSvR/OU5T+CTUxUBvs0K 81VHRX0FcDkv0b5wlk+4w0/zSibw5PTPZ3UClQBraHQfKaFu9uCnV+mnc3Y19E1Z aKolwuJltFyF586Dw2Ns5Yo= Received: (qmail 22001 invoked by alias); 3 Jan 2020 12:27:30 -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 21582 invoked by uid 89); 3 Jan 2020 12:26:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=sensitive X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Jan 2020 12:26:50 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 88F31ADFB; Fri, 3 Jan 2020 12:26:47 +0000 (UTC) From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Mark param_max_fields_for_field_sensitive with Optimization keyword. To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, Richard Biener Message-ID: <505b5acb-d240-6e68-cc3d-c8b25fd92a6c@suse.cz> Date: Fri, 3 Jan 2020 13:26:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 X-IsSubscribed: yes Hi. One another fix where -Ox sets a parameter that is not marked with Optimize keyword. Fixed by adding the keyword. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: 2020-01-03 Martin Liska PR tree-optimization/92860 * params.opt: (param_max_fields_for_field_sensitive): Mark with Optimization keyword. * tree-ssa-structalias.c (use_field_sensitive): Make it a function. (get_constraint_for_ptr_offset): Call it. (create_variable_info_for_1): Likewise. (init_alias_vars): Do not initialize use_field_sensitive. --- gcc/params.opt | 2 +- gcc/tree-ssa-structalias.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/params.opt b/gcc/params.opt index c58a375e4c8..9c5f98f3a00 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -427,7 +427,7 @@ Common Joined UInteger Var(param_early_inliner_max_iterations) Init(1) Param The maximum number of nested indirect inlining performed by early inliner. -param=max-fields-for-field-sensitive= -Common Joined UInteger Var(param_max_fields_for_field_sensitive) Param +Common Joined UInteger Var(param_max_fields_for_field_sensitive) Param Optimization Maximum number of fields in a structure before pointer analysis treats the structure as a single variable. -param=max-fsm-thread-length= diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 22e904444f1..2617109c1da 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -197,7 +197,6 @@ And probably more. */ -static bool use_field_sensitive = true; static int in_ipa_mode = 0; /* Used for predecessor bitmaps. */ @@ -337,6 +336,14 @@ struct obstack final_solutions_obstack; Indexed directly by variable info id. */ static vec varmap; +/* Return true if the algorithm should be field sensitive. */ + +static bool +use_field_sensitive () +{ + return param_max_fields_for_field_sensitive > 1; +} + /* Return the varmap element N */ static inline varinfo_t @@ -3134,7 +3141,7 @@ get_constraint_for_ptr_offset (tree ptr, tree offset, /* If we do not do field-sensitive PTA adding offsets to pointers does not change the points-to solution. */ - if (!use_field_sensitive) + if (!use_field_sensitive ()) { get_constraint_for_rhs (ptr, results); return; @@ -6075,7 +6082,7 @@ create_variable_info_for_1 (tree decl, const char *name, bool add_id, } /* Collect field information. */ - if (use_field_sensitive + if (use_field_sensitive () && var_can_have_subvars (decl) /* ??? Force us to not use subfields for globals in IPA mode. Else we'd have to parse arbitrary initializers. */ @@ -7182,8 +7189,6 @@ init_base_vars (void) static void init_alias_vars (void) { - use_field_sensitive = (param_max_fields_for_field_sensitive > 1); - bitmap_obstack_initialize (&pta_obstack); bitmap_obstack_initialize (&oldpta_obstack); bitmap_obstack_initialize (&predbitmap_obstack);