From patchwork Thu May 28 12:23:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kewen.Lin" X-Patchwork-Id: 1299734 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=DYKXz4a5; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Xn0m0B59z9sSF for ; Thu, 28 May 2020 22:23:18 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EBB393973084; Thu, 28 May 2020 12:23:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBB393973084 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590668596; bh=r1zoVZFfZjdMhqz+DTTfUJKZwqdGLTNNb18RdHQtqX4=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DYKXz4a5RXQtP0juuI8wiPS5kj9+YG1dZq1DhHMpD71KO3n8+bL/InPLNSZRovjoX fxcUY78nfQLu+fpRH2MNxz5vBFeeTwhxMuQnUucrHHccgCoyjv+8+l5y0zZgjdBAsW szhRRC0Avgd7iBbWgyDFQMYyZipkzCLiUHdCY1+Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id EB57E387085E for ; Thu, 28 May 2020 12:23:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB57E387085E Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04SCAuLW184566; Thu, 28 May 2020 08:23:10 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 319sqfsg8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 May 2020 08:23:10 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 04SCAuXL184563; Thu, 28 May 2020 08:23:10 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 319sqfsg7j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 May 2020 08:23:09 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 04SCKmJ2027531; Thu, 28 May 2020 12:23:07 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 316uf840jg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 May 2020 12:23:07 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 04SCN4ln53149776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 May 2020 12:23:04 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62C0442042; Thu, 28 May 2020 12:23:04 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B4A74203F; Thu, 28 May 2020 12:23:01 +0000 (GMT) Received: from KewenLins-MacBook-Pro.local (unknown [9.200.42.251]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 28 May 2020 12:23:01 +0000 (GMT) Subject: [PATCH 2/4] param: Introduce one param to control ivopts reg-offset consideration To: GCC Patches References: Message-ID: Date: Thu, 28 May 2020 20:23:00 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-05-28_03:2020-05-28, 2020-05-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 suspectscore=0 bulkscore=0 phishscore=0 cotscore=-2147483648 priorityscore=1501 lowpriorityscore=0 spamscore=0 clxscore=1015 malwarescore=0 adultscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005280084 X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Kewen.Lin via Gcc-patches" From: "Kewen.Lin" Reply-To: "Kewen.Lin" Cc: Richard Guenther , Segher Boessenkool , ubizjak@gmail.com, Bill Schmidt Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc/ChangeLog 2020-MM-DD Kewen Lin * doc/invoke.texi (iv-consider-reg-offset-for-unroll): Document new option. * params.opt (iv-consider-reg-offset-for-unroll): New. * config/s390/s390.c (s390_option_override_internal): Disable parameter iv-consider-reg-offset-for-unroll by default. * config/i386/i386-options.c (ix86_option_override_internal): Likewise. ---- diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index e0be493..41c99b3 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -2902,6 +2902,12 @@ ix86_option_override_internal (bool main_args_p, if (ix86_indirect_branch != indirect_branch_keep) SET_OPTION_IF_UNSET (opts, opts_set, flag_jump_tables, 0); + /* Disable this for now till loop_unroll_adjust supports gimple level checks, + to avoid possible ICE. */ + if (opts->x_optimize >= 1) + SET_OPTION_IF_UNSET (opts, opts_set, + param_iv_consider_reg_offset_for_unroll, 0); + return true; } diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index ebba670..ae4c2bd 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -15318,6 +15318,12 @@ s390_option_override_internal (struct gcc_options *opts, not the case when the code runs before the prolog. */ if (opts->x_flag_fentry && !TARGET_64BIT) error ("%<-mfentry%> is supported only for 64-bit CPUs"); + + /* Disable this for now till loop_unroll_adjust supports gimple level checks, + to avoid possible ICE. */ + if (opts->x_optimize >= 1) + SET_OPTION_IF_UNSET (opts, opts_set, + param_iv_consider_reg_offset_for_unroll, 0); } static void diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index fa98e2f..502031c 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -12220,6 +12220,15 @@ If the number of candidates in the set is smaller than this value, always try to remove unnecessary ivs from the set when adding a new one. +@item iv-consider-reg-offset-for-unroll +When RTL unrolling performs on a loop, the duplicated loop iterations introduce +appropriate induction variable step update expressions. But if an induction +variable is derived from address object, it is profitable to fill its required +offset updates into appropriate memory access expressions if target memory +accessing supports the register offset mode and the resulted offset is in the +valid range. The induction variable optimizations consider this information +for better unrolling code. It requires unroll factor estimation in middle-end. + @item avg-loop-niter Average number of iterations of a loop. diff --git a/gcc/params.opt b/gcc/params.opt index 8e4217d..31424cf 100644 --- a/gcc/params.opt +++ b/gcc/params.opt @@ -270,6 +270,10 @@ Bound on number of candidates below that all candidates are considered in iv opt Common Joined UInteger Var(param_iv_max_considered_uses) Init(250) Param Optimization Bound on number of iv uses in loop optimized in iv optimizations. +-param=iv-consider-reg-offset-for-unroll= +Common Joined UInteger Var(param_iv_consider_reg_offset_for_unroll) Init(1) Optimization IntegerRange(0, 1) Param +Whether iv optimizations mark register offset valid groups and consider their derived iv candidates would be profitable with estimated unroll factor consideration. + -param=jump-table-max-growth-ratio-for-size= Common Joined UInteger Var(param_jump_table_max_growth_ratio_for_size) Init(300) Param Optimization The maximum code size growth ratio when expanding into a jump table (in percent). The parameter is used when optimizing for size.