From patchwork Fri Aug 3 08:53:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 174952 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 BDC902C00A3 for ; Fri, 3 Aug 2012 18:53:38 +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=1344588819; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=dXp8s0DOikBE1HPqMTJZ pogqwog=; b=msgiIbMFq/oKDNFWpwbFkL6Wrc7HdClbbqR1uac8YsQjU4x69iuF Wyjl9W1oWhnqi3gKI6hrmb4Nk91GI+6VKna8on2LUl3Lpb6U/SpgCF4FYACaM4P3 gmgaX+1eJRHkM9greSf1ayu8To2Ix7BvyF1yM8CU1o5p674ZVK4DRW0= 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:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=YiJ6KTrzGiHGr+4Ru36nUHjkqPaqg8ZbvYEte4dJVGJKuxsb+h6BtMLdJf0ptv EZLEGpjHXzJBugYS9dgns1MwTtdBJ3vpAVApoF7bMvXfNMBbkWS6xrN1A3RSGpab eA19fZOE9CrR46NdlNOTrXr0NjAJjlRyAby3vC0fu9yfM=; Received: (qmail 373 invoked by alias); 3 Aug 2012 08:53:33 -0000 Received: (qmail 361 invoked by uid 22791); 3 Aug 2012 08:53:31 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, TW_TM, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Aug 2012 08:53:16 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 1505CA2111 for ; Fri, 3 Aug 2012 10:53:15 +0200 (CEST) Date: Fri, 3 Aug 2012 10:53:15 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH][1/n] Allow anonymous SSA names Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This first patch simplifies code that queries SSA names for their type, whether they are a register, and other minor stuff we have other means for. This is to avoid useless references to SSA_NAME_VAR which further patches in this series will allow to be NULL. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2012-08-03 Richard Guenther * tree-vect-loop-manip.c (vect_can_advance_ivs_p): Query is_gimple_reg on the SSA name, not its variable. (vect_update_ivs_after_vectorizer): Likewise. * tree-ssa-copyrename.c (rename_ssa_copies): Likewise. * tree-if-conv.c (if_convertible_phi_p): Likewise. (predicate_scalar_phi): Likewise. * tree-vect-loop.c (vect_analyze_scalar_cycles_1): Likewise. (vect_analyze_scalar_cycles_1): Likewise. * tree-ssa-live.c (register_ssa_partition_check): Likewise. * tree-outof-ssa.c (eliminate_useless_phis): Likewise. * tree-ssa-reassoc.c (phi_rank): Likewise. * tree-parloops.c (separate_decls_in_region_name): Use replace_ssa_name_symbol. * tree-predcom.c (base_names_in_chain_on): Likewise. * matrix-reorg.c (update_type_size): Query the type of the SSA name, not its variable. * gimple-ssa-strength-reduction.c (create_mul_ssa_cand): Likewise. (create_mul_imm_cand): Likewise. (create_add_ssa_cand): Likewise. (create_add_imm_cand): Likewise. (slsr_process_add): Likewise. * tree-inline.c (remap_ssa_name): Do not set the type of the new SSA_NAME. * tree-ssa-structalias.c (get_constraint_for_ssa_var): Clarify assert. Check for default def first. Index: gcc/tree-vect-loop-manip.c =================================================================== --- gcc/tree-vect-loop-manip.c (revision 190083) +++ gcc/tree-vect-loop-manip.c (working copy) @@ -1658,7 +1658,7 @@ vect_can_advance_ivs_p (loop_vec_info lo /* Skip virtual phi's. The data dependences that are associated with virtual defs/uses (i.e., memory accesses) are analyzed elsewhere. */ - if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi)))) + if (!is_gimple_reg (PHI_RESULT (phi))) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "virtual phi. skip."); @@ -1788,7 +1788,7 @@ vect_update_ivs_after_vectorizer (loop_v } /* Skip virtual phi's. */ - if (!is_gimple_reg (SSA_NAME_VAR (PHI_RESULT (phi)))) + if (!is_gimple_reg (PHI_RESULT (phi))) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "virtual phi. skip."); Index: gcc/tree-ssa-copyrename.c =================================================================== --- gcc/tree-ssa-copyrename.c (revision 190083) +++ gcc/tree-ssa-copyrename.c (working copy) @@ -332,7 +332,7 @@ rename_ssa_copies (void) res = gimple_phi_result (phi); /* Do not process virtual SSA_NAMES. */ - if (!is_gimple_reg (SSA_NAME_VAR (res))) + if (!is_gimple_reg (res)) continue; for (i = 0; i < gimple_phi_num_args (phi); i++) Index: gcc/tree-parloops.c =================================================================== --- gcc/tree-parloops.c (revision 190083) +++ gcc/tree-parloops.c (working copy) @@ -837,7 +837,7 @@ separate_decls_in_region_name (tree name copy = name; } - SSA_NAME_VAR (copy) = var_copy; + replace_ssa_name_symbol (copy, var_copy); return copy; } Index: gcc/matrix-reorg.c =================================================================== --- gcc/matrix-reorg.c (revision 190083) +++ gcc/matrix-reorg.c (working copy) @@ -976,11 +976,10 @@ update_type_size (struct matrix_info *mi { lhs = gimple_assign_lhs (stmt); gcc_assert (POINTER_TYPE_P - (TREE_TYPE (SSA_NAME_VAR (TREE_OPERAND (lhs, 0))))); + (TREE_TYPE (TREE_OPERAND (lhs, 0)))); type_size = int_size_in_bytes (TREE_TYPE - (TREE_TYPE - (SSA_NAME_VAR (TREE_OPERAND (lhs, 0))))); + (TREE_TYPE (TREE_OPERAND (lhs, 0)))); } else type_size = int_size_in_bytes (TREE_TYPE (ssa_var)); Index: gcc/gimple-ssa-strength-reduction.c =================================================================== --- gcc/gimple-ssa-strength-reduction.c (revision 190083) +++ gcc/gimple-ssa-strength-reduction.c (working copy) @@ -656,7 +656,7 @@ create_mul_ssa_cand (gimple gs, tree bas base = base_in; index = double_int_zero; stride = stride_in; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); } c = alloc_cand_and_find_basis (CAND_MULT, gs, base, index, stride, @@ -744,7 +744,7 @@ create_mul_imm_cand (gimple gs, tree bas base = base_in; index = double_int_zero; stride = stride_in; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); } c = alloc_cand_and_find_basis (CAND_MULT, gs, base, index, stride, @@ -828,7 +828,7 @@ create_add_ssa_cand (gimple gs, tree bas if (subtract_p) index = double_int_neg (index); stride = addend_cand->base_expr; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); if (has_single_use (addend_in)) savings = (addend_cand->dead_savings + stmt_cost (addend_cand->cand_stmt, speed)); @@ -877,7 +877,7 @@ create_add_ssa_cand (gimple gs, tree bas index = tree_to_double_int (subtrahend_cand->stride); index = double_int_neg (index); stride = subtrahend_cand->base_expr; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); if (has_single_use (addend_in)) savings = (subtrahend_cand->dead_savings + stmt_cost (subtrahend_cand->cand_stmt, speed)); @@ -903,7 +903,7 @@ create_add_ssa_cand (gimple gs, tree bas base = base_in; index = subtract_p ? double_int_minus_one : double_int_one; stride = addend_in; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); } c = alloc_cand_and_find_basis (CAND_ADD, gs, base, index, stride, @@ -968,7 +968,7 @@ create_add_imm_cand (gimple gs, tree bas base = base_in; index = index_in; stride = integer_one_node; - ctype = TREE_TYPE (SSA_NAME_VAR (base_in)); + ctype = TREE_TYPE (base_in); } c = alloc_cand_and_find_basis (kind, gs, base, index, stride, @@ -990,7 +990,7 @@ slsr_process_add (gimple gs, tree rhs1, /* First record an interpretation assuming RHS1 is the base expression and RHS2 is the stride. But it doesn't make sense for the stride to be a pointer, so don't record a candidate in that case. */ - if (!POINTER_TYPE_P (TREE_TYPE (SSA_NAME_VAR (rhs2)))) + if (!POINTER_TYPE_P (TREE_TYPE (rhs2))) { c = create_add_ssa_cand (gs, rhs1, rhs2, subtract_p, speed); @@ -1007,7 +1007,7 @@ slsr_process_add (gimple gs, tree rhs1, /* Otherwise, record another interpretation assuming RHS2 is the base expression and RHS1 is the stride, again provided that the stride is not a pointer. */ - if (!POINTER_TYPE_P (TREE_TYPE (SSA_NAME_VAR (rhs1)))) + if (!POINTER_TYPE_P (TREE_TYPE (rhs1))) { c2 = create_add_ssa_cand (gs, rhs2, rhs1, false, speed); if (c) Index: gcc/tree-if-conv.c =================================================================== --- gcc/tree-if-conv.c (revision 190083) +++ gcc/tree-if-conv.c (working copy) @@ -425,7 +425,7 @@ if_convertible_phi_p (struct loop *loop, /* When the flag_tree_loop_if_convert_stores is not set, check that there are no memory writes in the branches of the loop to be if-converted. */ - if (!is_gimple_reg (SSA_NAME_VAR (gimple_phi_result (phi)))) + if (!is_gimple_reg (gimple_phi_result (phi))) { imm_use_iterator imm_iter; use_operand_p use_p; @@ -1277,7 +1277,7 @@ predicate_scalar_phi (gimple phi, tree c res = gimple_phi_result (phi); /* Do not handle virtual phi nodes. */ - if (!is_gimple_reg (SSA_NAME_VAR (res))) + if (!is_gimple_reg (res)) return; bb = gimple_bb (phi); Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 190083) +++ gcc/tree-vect-loop.c (working copy) @@ -555,7 +555,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_i /* Skip virtual phi's. The data dependences that are associated with virtual defs/uses (i.e., memory accesses) are analyzed elsewhere. */ - if (!is_gimple_reg (SSA_NAME_VAR (def))) + if (!is_gimple_reg (def)) continue; STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_unknown_def_type; @@ -604,7 +604,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_i print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM); } - gcc_assert (is_gimple_reg (SSA_NAME_VAR (def))); + gcc_assert (is_gimple_reg (def)); gcc_assert (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_unknown_def_type); nested_cycle = (loop != LOOP_VINFO_LOOP (loop_vinfo)); Index: gcc/tree-ssa-live.c =================================================================== --- gcc/tree-ssa-live.c (revision 190083) +++ gcc/tree-ssa-live.c (working copy) @@ -1199,7 +1199,7 @@ void register_ssa_partition_check (tree ssa_var) { gcc_assert (TREE_CODE (ssa_var) == SSA_NAME); - if (!is_gimple_reg (SSA_NAME_VAR (ssa_var))) + if (!is_gimple_reg (ssa_var)) { fprintf (stderr, "Illegally registering a virtual SSA name :"); print_generic_expr (stderr, ssa_var, TDF_SLIM); Index: gcc/tree-predcom.c =================================================================== --- gcc/tree-predcom.c (revision 190083) +++ gcc/tree-predcom.c (working copy) @@ -1862,7 +1862,7 @@ base_names_in_chain_on (struct loop *loo gimple stmt, phi; imm_use_iterator iter; - SSA_NAME_VAR (name) = var; + replace_ssa_name_symbol (name, var); while (1) { @@ -1880,7 +1880,7 @@ base_names_in_chain_on (struct loop *loo return; name = PHI_RESULT (phi); - SSA_NAME_VAR (name) = var; + replace_ssa_name_symbol (name, var); } } Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c (revision 190083) +++ gcc/tree-inline.c (working copy) @@ -237,7 +237,6 @@ remap_ssa_name (tree name, copy_body_dat insert_decl_map (id, name, new_tree); SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree) = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name); - TREE_TYPE (new_tree) = TREE_TYPE (SSA_NAME_VAR (new_tree)); /* At least IPA points-to info can be directly transferred. */ if (id->src_cfun->gimple_df && id->src_cfun->gimple_df->ipa_pta Index: gcc/tree-outof-ssa.c =================================================================== --- gcc/tree-outof-ssa.c (revision 190083) +++ gcc/tree-outof-ssa.c (working copy) @@ -762,7 +762,7 @@ eliminate_useless_phis (void) { gimple phi = gsi_stmt (gsi); result = gimple_phi_result (phi); - if (!is_gimple_reg (SSA_NAME_VAR (result))) + if (!is_gimple_reg (result)) { #ifdef ENABLE_CHECKING size_t i; @@ -772,7 +772,7 @@ eliminate_useless_phis (void) { tree arg = PHI_ARG_DEF (phi, i); if (TREE_CODE (arg) == SSA_NAME - && is_gimple_reg (SSA_NAME_VAR (arg))) + && is_gimple_reg (arg)) { fprintf (stderr, "Argument of PHI is not virtual ("); print_generic_expr (stderr, arg, TDF_SLIM); Index: gcc/tree-ssa-structalias.c =================================================================== --- gcc/tree-ssa-structalias.c (revision 190083) +++ gcc/tree-ssa-structalias.c (working copy) @@ -2736,14 +2736,14 @@ get_constraint_for_ssa_var (tree t, VEC( varinfo_t vi; /* We allow FUNCTION_DECLs here even though it doesn't make much sense. */ - gcc_assert (SSA_VAR_P (t) || DECL_P (t)); + gcc_assert (TREE_CODE (t) == SSA_NAME || DECL_P (t)); /* For parameters, get at the points-to set for the actual parm decl. */ if (TREE_CODE (t) == SSA_NAME + && SSA_NAME_IS_DEFAULT_DEF (t) && (TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL - || TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL) - && SSA_NAME_IS_DEFAULT_DEF (t)) + || TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL)) { get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p); return; Index: gcc/tree-ssa-reassoc.c =================================================================== --- gcc/tree-ssa-reassoc.c (revision 190083) +++ gcc/tree-ssa-reassoc.c (working copy) @@ -234,7 +234,7 @@ phi_rank (gimple stmt) /* Ignore virtual SSA_NAMEs. */ res = gimple_phi_result (stmt); - if (!is_gimple_reg (SSA_NAME_VAR (res))) + if (!is_gimple_reg (res)) return bb_rank[bb->index]; /* The phi definition must have a single use, and that use must be