From patchwork Tue Jul 17 15:14:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 171467 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 17F782C00B3 for ; Wed, 18 Jul 2012 01:46:57 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343144818; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Message-ID:Subject:From:To: Cc:Date:Content-Type:Content-Transfer-Encoding:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=XxSg53D9XzwVL7Z/X14w rH0Pxl0=; b=TuHY05LpPO4wm8xSu63eL6qpsUrpDtGLPOTbkxZ87xaZvlA0vRAa XSECyZZl5hInP1JgDJmqBDfGrF+O7FlAGgrv70QI65wonnbocdomsv0SFhyMy2/f z5p05gSb2kZgS8Hkmrn6HOZmYqTXrRpQcoqT9xOJQ9TXavVrLDjGqxY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Received:Message-ID:Subject:From:To:Cc:Date:Content-Type:Content-Transfer-Encoding:Mime-Version:X-Content-Scanned:x-cbid:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=T0puI5kFSvpYjdnmFqQnby9ZQGUgzxO45bVDbNdzzhvD1DJgT/YIhuChI2cPL6 DNoTa5a1sieK8pm25Eyj5WdcTGacnHi1WpYLVi6Yfp3fBT4uzafqqlFdDwx+lj+8 mb4BAguIiMmJ0J4/Bfz60i8ypRJMde+au8uB9abc3B5hQ=; Received: (qmail 26320 invoked by alias); 17 Jul 2012 15:46:47 -0000 Received: (qmail 26306 invoked by uid 22791); 17 Jul 2012 15:46:44 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e37.co.us.ibm.com (HELO e37.co.us.ibm.com) (32.97.110.158) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jul 2012 15:46:21 +0000 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Jul 2012 09:46:18 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Jul 2012 09:45:39 -0600 Received: from d03relay03.boulder.ibm.com (d03relay03.boulder.ibm.com [9.17.195.228]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 5134B3E40D36 for ; Tue, 17 Jul 2012 15:15:21 +0000 (WET) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay03.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6HFF87c262790 for ; Tue, 17 Jul 2012 09:15:09 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6HFF5Ar023955 for ; Tue, 17 Jul 2012 09:15:05 -0600 Received: from [9.76.47.115] (sig-9-76-47-115.mts.ibm.com [9.76.47.115]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q6HFEsI0022172; Tue, 17 Jul 2012 09:14:55 -0600 Message-ID: <1342538095.3470.59.camel@gnopaine> Subject: [PATCH] Add flag to control straight-line strength reduction From: "William J. Schmidt" To: gcc-patches@gcc.gnu.org Cc: bergner@vnet.ibm.com, rguenther@suse.de Date: Tue, 17 Jul 2012 10:14:55 -0500 Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12071715-7408-0000-0000-000006D57CFB 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 I overlooked adding a pass-control flag for strength reduction, added here. I named it -ftree-slsr for consistency with other -ftree- flags, but could change it to -fgimple-slsr if you prefer that for a pass named gimple-ssa-... Bootstrapped and tested on powerpc-unknown-linux-gnu with no new regressions. Ok for trunk? Thanks, Bill 2012-07-17 Bill Schmidt * opts.c (default_option): Make -ftree-slsr default at -O1 and above. * gimple-ssa-strength-reduction.c (gate_strength_reduction): Use flag_tree_slsr. * common.opt: Add -ftree-slsr with flag_tree_slsr. Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 189574) +++ gcc/opts.c (working copy) @@ -452,6 +452,7 @@ static const struct default_options default_option { OPT_LEVELS_1_PLUS, OPT_ftree_ch, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fcombine_stack_adjustments, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fcompare_elim, NULL, 1 }, + { OPT_LEVELS_1_PLUS, OPT_ftree_slsr, NULL, 1 }, /* -O2 optimizations. */ { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 189574) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -1501,7 +1501,7 @@ execute_strength_reduction (void) static bool gate_strength_reduction (void) { - return optimize > 0; + return flag_tree_slsr; } struct gimple_opt_pass pass_strength_reduction = Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 189574) +++ gcc/common.opt (working copy) @@ -2080,6 +2080,10 @@ ftree-sink Common Report Var(flag_tree_sink) Optimization Enable SSA code sinking on trees +ftree-slsr +Common Report Var(flag_tree_slsr) Optimization +Perform straight-line strength reduction + ftree-sra Common Report Var(flag_tree_sra) Optimization Perform scalar replacement of aggregates