From patchwork Mon Sep 10 17:36:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 182934 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 CD0642C007E for ; Tue, 11 Sep 2012 03:37:22 +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=1347903443; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:Subject:From:To:Cc: In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=pp6pLCyIgKAxgzSKJqWIAMHZH3Q=; b=b2CIk4IKiMl1PY5 GjapBXpGYXyyECbhdODUps1nhV1vPZu2aLphx5lK/OjfIMucuowdOM6DLY349rWO 3x6JHVRcT8tNPwelflgbjB2PApMY6RbHyf73deirhKfv+VpOiiH3QVrUzzHxcBry vjYU+ESLgdKzN70zYbUhp/7sDjrQ= 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:Subject:From:To:Cc:In-Reply-To:References:Content-Type:Date:Message-ID:Mime-Version:Content-Transfer-Encoding:X-Content-Scanned:x-cbid:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=B0E0uAZIJ41DOec7NtDl5qqMQjJARp3E0EHf9Jk6LsVEA4CNfkrUavubTLQkyK gvc6eYSl5Fqu3MK1GLFEeQ+Dq0qNsu+kXNRzR3H/4qkpg/tULkVWVcxOej8QPSG1 9DtyU/CEpA1jLUw8i2nx9JQSubvK36ycG+tEZBvopybCc=; Received: (qmail 12590 invoked by alias); 10 Sep 2012 17:37:17 -0000 Received: (qmail 12410 invoked by uid 22791); 10 Sep 2012 17:37:15 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, MAY_BE_FORGED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e38.co.us.ibm.com (HELO e38.co.us.ibm.com) (32.97.110.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Sep 2012 17:37:02 +0000 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Sep 2012 11:37:00 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 10 Sep 2012 11:36:35 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 62FFA19D8040 for ; Mon, 10 Sep 2012 11:36:34 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8AHaUcE205574 for ; Mon, 10 Sep 2012 11:36:31 -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 q8AHaSl9006778 for ; Mon, 10 Sep 2012 11:36:28 -0600 Received: from [9.10.86.196] (gressett-6474cv1-r8dvc59.rchland.ibm.com [9.10.86.196] (may be forged)) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8AHaRht006736; Mon, 10 Sep 2012 11:36:27 -0600 Subject: Re: [PATCH] Fix PR54492 From: "William J. Schmidt" To: Richard Guenther Cc: Jakub Jelinek , gcc-patches@gcc.gnu.org, bergner@vnet.ibm.com In-Reply-To: References: <1347288007.4740.4.camel@oc2474580526.ibm.com> <20120910145040.GI22619@tucnak.redhat.com> Date: Mon, 10 Sep 2012 12:36:25 -0500 Message-ID: <1347298585.4740.13.camel@oc2474580526.ibm.com> Mime-Version: 1.0 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12091017-5518-0000-0000-0000078A390C X-IsSubscribed: yes 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 Here's the revised patch with a param. Bootstrapped and tested in the same manner. Ok for trunk? Thanks, Bill 2012-08-10 Bill Schmidt * doc/invoke.texi (max-slsr-cand-scan): New description. * gimple-ssa-strength-reduction.c (find_basis_for_candidate): Limit the time spent searching for a basis. * params.def (PARAM_MAX_SLSR_CANDIDATE_SCAN): New param. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 191135) +++ gcc/doc/invoke.texi (working copy) @@ -9407,6 +9407,11 @@ having a regular register file and accurate regist See @file{haifa-sched.c} in the GCC sources for more details. The default choice depends on the target. + +@item max-slsr-cand-scan +Set the maximum number of existing candidates that will be considered when +seeking a basis for a new straight-line strength reduction candidate. + @end table @end table Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 191135) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see #include "domwalk.h" #include "pointer-set.h" #include "expmed.h" +#include "params.h" /* Information about a strength reduction candidate. Each statement in the candidate table represents an expression of one of the @@ -353,10 +354,14 @@ find_basis_for_candidate (slsr_cand_t c) cand_chain_t chain; slsr_cand_t basis = NULL; + // Limit potential of N^2 behavior for long candidate chains. + int iters = 0; + int max_iters = PARAM_VALUE (PARAM_MAX_SLSR_CANDIDATE_SCAN); + mapping_key.base_expr = c->base_expr; chain = (cand_chain_t) htab_find (base_cand_map, &mapping_key); - for (; chain; chain = chain->next) + for (; chain && iters < max_iters; chain = chain->next, ++iters) { slsr_cand_t one_basis = chain->cand; Index: gcc/params.def =================================================================== --- gcc/params.def (revision 191135) +++ gcc/params.def (working copy) @@ -973,6 +973,13 @@ DEFPARAM (PARAM_SCHED_PRESSURE_ALGORITHM, "Which -fsched-pressure algorithm to apply", 1, 1, 2) +/* Maximum length of candidate scans in straight-line strength reduction. */ +DEFPARAM (PARAM_MAX_SLSR_CANDIDATE_SCAN, + "max-slsr-cand-scan", + "Maximum length of candidate scans for straight-line " + "strength reduction", + 50, 1, 999999) + /* Local variables: mode:c