From patchwork Mon May 6 15:42:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Schmidt X-Patchwork-Id: 241711 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 922262C00FA for ; Tue, 7 May 2013 01:43:41 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:cc:content-type:date:message-id:mime-version :content-transfer-encoding; q=dns; s=default; b=n3eAqBdw8hk7xYYv UGCr5d/nCwwfvVaiPxxK76mao5+OnWrKGTjaeDIE/ERHOTI8gEnAaJ2G5pzZCzkK hRc0Y1hButc/bM6Sl2uXSMpH+z/jCyKHdJy3yvHBSnibY38MM3Pjf1SXeaSkdubS QO7ahrIJuh6HaHiyE5xOT/CarVw= 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 :subject:from:to:cc:content-type:date:message-id:mime-version :content-transfer-encoding; s=default; bh=2ozXytgEJkwMAm3pdpaJGk 6QcBI=; b=xx3q3f3g76gEe4MITxsOPu0mUQ5haq0gdgIjuG0kT0vyc3HCuoKu1s IBCtCuxLqPJgRmxQjiKq8V4NlqrnVpKU5hOTflwqPb4N0eM/femjaXZLgtIrGnGF V5Aey5YtYtr0xAVC4TpIZ60Y9IdEszzo+LCX0iAsoT7UmcSvM7a28= Received: (qmail 21310 invoked by alias); 6 May 2013 15:43:35 -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 21289 invoked by uid 89); 6 May 2013 15:43:30 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MAY_BE_FORGED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, TW_TM autolearn=ham version=3.3.1 Received: from e8.ny.us.ibm.com (HELO e8.ny.us.ibm.com) (32.97.182.138) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 06 May 2013 15:43:29 +0000 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 May 2013 11:43:27 -0400 Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 6 May 2013 11:43:25 -0400 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 155FDC90046 for ; Mon, 6 May 2013 11:43:24 -0400 (EDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r46FhNP5294958 for ; Mon, 6 May 2013 11:43:24 -0400 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 r46FgHxa016538 for ; Mon, 6 May 2013 09:42:17 -0600 Received: from [9.10.86.97] (oc8801110288.ibm.com.rchland.ibm.com [9.10.86.97] (may be forged)) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r46FgDa2016137; Mon, 6 May 2013 09:42:13 -0600 Subject: [PATCH] Use anonymous SSA name support in SLSR From: Bill Schmidt To: gcc-patches@gcc.gnu.org Cc: rguenth@suse.de Date: Mon, 06 May 2013 10:42:13 -0500 Message-ID: <1367854933.4938.5.camel@oc8801110288.ibm.com> Mime-Version: 1.0 X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13050615-9360-0000-0000-0000120B8119 This removes lazy_create_slsr_reg and replaces uses of make_ssa_name with make_temp_ssa_name, removing the need for a bunch of unnecessary vars. Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new regressions. Ok for trunk? Thanks, Bill 2013-05-06 Bill Schmidt * gimple-ssa-strength-reduction.c (lazy_create_slsr_reg): Remove. (replace_mult_candidate): Remove unnecessary argument; remove unnecessary parameter from call to introduce_cast_before_cand. (replace_unconditional_candidate): Remove unnecessary parameter from call to replace_mult_candidate. (replace_conditional_candidate): Likewise. (insert_initializers): Use make_temp_ssa_name. (introduce_cast_before_cand): Remove unnecessary argument; use make_temp_ssa_name. (replace_one_candidate): Remove unnecessary argument; remove unnecessary parameter from calls to introduce_cast_before_cand. (replace_profitable_candidates): Remove unnecessary parameters from calls to replace_one_candidate. Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 198627) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -376,7 +376,7 @@ static bool address_arithmetic_p; /* Forward function declarations. */ static slsr_cand_t base_cand_from_table (tree); -static tree introduce_cast_before_cand (slsr_cand_t, tree, tree, tree*); +static tree introduce_cast_before_cand (slsr_cand_t, tree, tree); /* Produce a pointer to the IDX'th candidate in the candidate vector. */ @@ -1818,16 +1818,6 @@ cand_abs_increment (slsr_cand_t c) return increment; } -/* If *VAR is NULL or is not of a compatible type with TYPE, create a - new temporary reg of type TYPE and store it in *VAR. */ - -static inline void -lazy_create_slsr_reg (tree *var, tree type) -{ - if (!*var || !types_compatible_p (TREE_TYPE (*var), type)) - *var = create_tmp_reg (type, "slsr"); -} - /* Return TRUE iff candidate C has already been replaced under another interpretation. */ @@ -1841,8 +1831,7 @@ cand_already_replaced (slsr_cand_t c) replace_conditional_candidate. */ static void -replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump, - tree *var) +replace_mult_candidate (slsr_cand_t c, tree basis_name, double_int bump) { tree target_type = TREE_TYPE (gimple_assign_lhs (c->cand_stmt)); enum tree_code cand_code = gimple_assign_rhs_code (c->cand_stmt); @@ -1869,8 +1858,7 @@ static void /* If the basis name and the candidate's LHS have incompatible types, introduce a cast. */ if (!useless_type_conversion_p (target_type, TREE_TYPE (basis_name))) - basis_name = introduce_cast_before_cand (c, target_type, - basis_name, var); + basis_name = introduce_cast_before_cand (c, target_type, basis_name); if (bump.is_negative ()) { code = MINUS_EXPR; @@ -1945,7 +1933,6 @@ replace_unconditional_candidate (slsr_cand_t c) { slsr_cand_t basis; double_int stride, bump; - tree var = NULL; if (cand_already_replaced (c)) return; @@ -1954,7 +1941,7 @@ replace_unconditional_candidate (slsr_cand_t c) stride = tree_to_double_int (c->stride); bump = cand_increment (c) * stride; - replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump, &var); + replace_mult_candidate (c, gimple_assign_lhs (basis->cand_stmt), bump); } /* Return the index in the increment vector of the given INCREMENT. */ @@ -2150,7 +2137,7 @@ create_phi_basis (slsr_cand_t c, gimple from_phi, static void replace_conditional_candidate (slsr_cand_t c) { - tree basis_name, name, var = NULL; + tree basis_name, name; slsr_cand_t basis; location_t loc; double_int stride, bump; @@ -2169,7 +2156,7 @@ replace_conditional_candidate (slsr_cand_t c) stride = tree_to_double_int (c->stride); bump = c->index * stride; - replace_mult_candidate (c, name, bump, &var); + replace_mult_candidate (c, name, bump); } /* Compute the expected costs of inserting basis adjustments for @@ -2925,7 +2912,6 @@ static void insert_initializers (slsr_cand_t c) { unsigned i; - tree new_var = NULL_TREE; for (i = 0; i < incr_vec_len; i++) { @@ -2963,8 +2949,7 @@ insert_initializers (slsr_cand_t c) /* Create a new SSA name to hold the initializer's value. */ stride_type = TREE_TYPE (c->stride); - lazy_create_slsr_reg (&new_var, stride_type); - new_name = make_ssa_name (new_var, NULL); + new_name = make_temp_ssa_name (stride_type, NULL, "slsr"); incr_vec[i].initializer = new_name; /* Create the initializer and insert it in the latest possible @@ -3062,15 +3047,13 @@ all_phi_incrs_profitable (slsr_cand_t c, gimple ph the new SSA name. */ static tree -introduce_cast_before_cand (slsr_cand_t c, tree to_type, - tree from_expr, tree *new_var) +introduce_cast_before_cand (slsr_cand_t c, tree to_type, tree from_expr) { tree cast_lhs; gimple cast_stmt; gimple_stmt_iterator gsi = gsi_for_stmt (c->cand_stmt); - lazy_create_slsr_reg (new_var, to_type); - cast_lhs = make_ssa_name (*new_var, NULL); + cast_lhs = make_temp_ssa_name (to_type, NULL, "slsr"); cast_stmt = gimple_build_assign_with_ops (NOP_EXPR, cast_lhs, from_expr, NULL_TREE); gimple_set_location (cast_stmt, gimple_location (c->cand_stmt)); @@ -3124,8 +3107,7 @@ replace_rhs_if_not_dup (enum tree_code new_code, t is the rhs1 to use in creating the add/subtract. */ static void -replace_one_candidate (slsr_cand_t c, unsigned i, tree *new_var, - tree basis_name) +replace_one_candidate (slsr_cand_t c, unsigned i, tree basis_name) { gimple stmt_to_print = NULL; tree orig_rhs1, orig_rhs2; @@ -3161,8 +3143,7 @@ static void rhs2 = incr_vec[i].initializer; else rhs2 = introduce_cast_before_cand (c, orig_type, - incr_vec[i].initializer, - new_var); + incr_vec[i].initializer); if (incr_vec[i].incr != cand_incr) { @@ -3188,7 +3169,7 @@ static void if (types_compatible_p (orig_type, stride_type)) rhs2 = c->stride; else - rhs2 = introduce_cast_before_cand (c, orig_type, c->stride, new_var); + rhs2 = introduce_cast_before_cand (c, orig_type, c->stride); stmt_to_print = replace_rhs_if_not_dup (repl_code, basis_name, rhs2, orig_code, orig_rhs1, orig_rhs2, @@ -3204,7 +3185,7 @@ static void if (types_compatible_p (orig_type, stride_type)) rhs2 = c->stride; else - rhs2 = introduce_cast_before_cand (c, orig_type, c->stride, new_var); + rhs2 = introduce_cast_before_cand (c, orig_type, c->stride); if (orig_code != MINUS_EXPR || !operand_equal_p (basis_name, orig_rhs1, 0) @@ -3270,7 +3251,6 @@ replace_profitable_candidates (slsr_cand_t c) if (!cand_already_replaced (c)) { double_int increment = cand_abs_increment (c); - tree new_var = NULL; enum tree_code orig_code = gimple_assign_rhs_code (c->cand_stmt); unsigned i; @@ -3302,14 +3282,14 @@ replace_profitable_candidates (slsr_cand_t c) /* Replace C with an add of the new basis phi and the increment. */ - replace_one_candidate (c, i, &new_var, name); + replace_one_candidate (c, i, name); } } else { slsr_cand_t basis = lookup_cand (c->basis); tree basis_name = gimple_assign_lhs (basis->cand_stmt); - replace_one_candidate (c, i, &new_var, basis_name); + replace_one_candidate (c, i, basis_name); } } }