From patchwork Thu Jun 27 18:25:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 255119 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 2D7CC2C00A6 for ; Fri, 28 Jun 2013 04:25:45 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=Kgs30ArCwB8XuOHc0hXG4EVsBx9e45nd48oOT6NHfkgRJL mJS8uPnP7Y1snzznJjOgd4OvSpNtVqWxO65c5HqGW0GD91f8sAdHkHAme2e91vSj udJuJGADG4b2rZLXWKqXLymgMkBaCBd6x1FgT/k2SecJ9xN8mMjZn0lEeE0cg= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=IpthI5PkoCJoKF3vP9TMUTWwYo4=; b=Dy3Nc8yZ0AI+BBLFmca0 Gcn59HTh3/0cBpp6U/mkaOewE2jOLjMRZ7puruoxd1yqyxckXiT3cOQIlOWciqOi Uzx/7DyXtgdeJs+t/TbDvyTJYScyca0WV43Lbkw7G0qMTpKQqsDftxYN4Pfl1eKK xehpr3VDYMHjb9xboW/849I= Received: (qmail 9448 invoked by alias); 27 Jun 2013 18:25:27 -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 9313 invoked by uid 89); 27 Jun 2013 18:25:26 -0000 X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 27 Jun 2013 18:25:25 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5RIPNuW007341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 27 Jun 2013 14:25:23 -0400 Received: from [10.10.59.188] (vpn-59-188.rdu2.redhat.com [10.10.59.188]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r5RIPMHM017952; Thu, 27 Jun 2013 14:25:22 -0400 Message-ID: <51CC8391.5000900@redhat.com> Date: Thu, 27 Jun 2013 14:25:21 -0400 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: gcc-patches , Richard Biener Subject: SSA identifiers X-Virus-Found: No I'm doing some trial file conversions to my proposed wrapper classes, I'm seeing a couple of places which aren't mapping properly (they triggered compile errors), and I think its because there is a couple of bugs regarding the use of IDENTIFIERS in ssanames.. (I wasn't even aware you could have non-var_decls...) so this is just a sanity check :-) the macros are defined as: /* Returns the IDENTIFIER_NODE giving the SSA name a name or NULL_TREE if there is no name associated with it. */ #define SSA_NAME_IDENTIFIER(NODE) \ (SSA_NAME_CHECK (NODE)->ssa_name.var != NULL_TREE \ ? (TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \ ? (NODE)->ssa_name.var \ : DECL_NAME ((NODE)->ssa_name.var)) \ : NULL_TREE) /* Returns the variable being referenced. This can be NULL_TREE for temporaries not associated with any user variable. Once released, this is the only field that can be relied upon. */ #define SSA_NAME_VAR(NODE) \ (SSA_NAME_CHECK (NODE)->ssa_name.var == NULL_TREE \ || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \ ? NULL_TREE : (NODE)->ssa_name.var) #define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \ do { SSA_NAME_CHECK (NODE)->ssa_name.var = (VAR); } while (0) in tree-ssanames.c:release_ssa_names() : if (! SSA_NAME_IN_FREE_LIST (var)) { tree saved_ssa_name_var = SSA_NAME_VAR (var); int saved_ssa_name_version = SSA_NAME_VERSION (var); use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var)); <..> /* Hopefully this can go away once we have the new incremental SSA updating code installed. */ SET_SSA_NAME_VAR_OR_IDENTIFIER (var, saved_ssa_name_var); It would seem to me that if the identifier is set rather than the vardecl, it is not going to be reset properly here since the saved value is going to be NULL rather than the identifier node... Or does it really matter here? Its not really clear to me. in tree-outof-ssa.c:insert_backedge_copies() : for (i = 0; i < gimple_phi_num_args (phi); i++) { tree arg = gimple_phi_arg_def (phi, i); edge e = gimple_phi_arg_edge (phi, i); /* If the argument is not an SSA_NAME, then we will need a constant initialization. If the argument is an SSA_NAME with a different underlying variable then a copy statement will be needed. */ if ((e->flags & EDGE_DFS_BACK) && (TREE_CODE (arg) != SSA_NAME || SSA_NAME_VAR (arg) != SSA_NAME_VAR (result) || trivially_conflicts_p (bb, result, arg))) If both SSA_NAMEs have an identifier, then "SSA_NAME_VAR(arg) != SSA_NAME_VAR(result)" is going to compare NULL_TREE != NULL_TREE every time... I would say its really looking to compare that underlying field TREE_CODE ((arg)->ssa_name.var != TREE_CODE ((result)->ssa_name.var They could both be resolved by adding an equivalent #define SSA_NAME_VAR_OR_IDENTIFIER(NODE (SSA_NAME_CHECK (NODE)->ssa_name.var) and using that macro instead of SSA_NAME_VAR.. and probably more efficient. something like that attached, which bootstraps but I haven't done a full testrun yet... Or perhaps even just use SSA_NAME_IDENTIFIER in both cases would work... seems dangerous if 2 different decls have the same identifier tho. It is interesting how these 2 cases just popped up as errors building during the conversion of those files... Early tangible benefit? :-) Andrew * tree.h (SSA_NAME_VAR_OR_IDENTIFIER): New. * tree-ssanames.c: Use instead of SSA_NAME_VAR. * tree-outof-ssa.c: Use instead of SSA_NAME_VAR. Index: tree.h =================================================================== --- tree.h (revision 196663) +++ tree.h (working copy) @@ -1917,6 +1918,8 @@ || TREE_CODE ((NODE)->ssa_name.var) == IDENTIFIER_NODE \ ? NULL_TREE : (NODE)->ssa_name.var) +#define SSA_NAME_VAR_OR_IDENTIFIER(NODE) (SSA_NAME_CHECK (NODE)->ssa_name.var) + #define SET_SSA_NAME_VAR_OR_IDENTIFIER(NODE,VAR) \ do { SSA_NAME_CHECK (NODE)->ssa_name.var = (VAR); } while (0) Index: tree-ssanames.c =================================================================== --- tree-ssanames.c (revision 195512) +++ tree-ssanames.c (working copy) @@ -200,7 +200,7 @@ defining statement. */ if (! SSA_NAME_IN_FREE_LIST (var)) { - tree saved_ssa_name_var = SSA_NAME_VAR (var); + tree saved_ssa_name_var = SSA_NAME_VAR_OR_IDENTIFIER (var); int saved_ssa_name_version = SSA_NAME_VERSION (var); use_operand_p imm = &(SSA_NAME_IMM_USE_NODE (var)); Index: tree-outof-ssa.c =================================================================== --- tree-outof-ssa.c (revision 195512) +++ tree-outof-ssa.c (working copy) @@ -1039,7 +1039,8 @@ needed. */ if ((e->flags & EDGE_DFS_BACK) && (TREE_CODE (arg) != SSA_NAME - || SSA_NAME_VAR (arg) != SSA_NAME_VAR (result) + || (SSA_NAME_VAR_OR_IDENTIFIER (arg) + != SSA_NAME_VAR_OR_IDENTIFIER (result)) || trivially_conflicts_p (bb, result, arg))) { tree name;