From patchwork Wed Dec 21 13:52:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 132643 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 490EEB711D for ; Thu, 22 Dec 2011 00:52:54 +1100 (EST) Received: (qmail 17993 invoked by alias); 21 Dec 2011 13:52:48 -0000 Received: (qmail 17977 invoked by uid 22791); 21 Dec 2011 13:52:44 -0000 X-SWARE-Spam-Status: No, hits=-7.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Dec 2011 13:52:19 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pBLDqIHY014697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 21 Dec 2011 08:52:18 -0500 Received: from austin.quesejoda.com (vpn-9-57.rdu.redhat.com [10.11.9.57]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pBLDqGqH027857; Wed, 21 Dec 2011 08:52:17 -0500 Message-ID: <4EF1E490.2090609@redhat.com> Date: Wed, 21 Dec 2011 07:52:16 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: Richard Guenther CC: gcc-patches , Richard Henderson Subject: Re: PR middle-end/51472: set DECL_GIMPLE_REG_P on TM vector saves References: <4EF0BE74.8050107@redhat.com> In-Reply-To: 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 > You can't simply do > > + if (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE > + || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE) > + DECL_GIMPLE_REG_P (var) = 1; > + update_stmt (stmt); > > where is 'var' created? At _that_ point you should do the above > (or use create_tmp_reg instead of create_tmp_var). Existing uses > of var might prevent DECL_GIMPLE_REG_P from being set > (which also means creating an SSA name of it is not allowed). Oh neat... create_tmp_reg will do all this for me. OK? PR middle-end/51472 * trans-mem.c (tm_log_emit_saves): Call update_stmt. (tm_log_add): Use create_tmp_var_reg. Index: testsuite/gcc.dg/tm/pr51472.c =================================================================== --- testsuite/gcc.dg/tm/pr51472.c (revision 0) +++ testsuite/gcc.dg/tm/pr51472.c (revision 0) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -O --param tm-max-aggregate-size=32" } */ + +typedef int __attribute__ ((vector_size (16))) vectype; +vectype v; + +void +foo (int c) +{ + vectype *p = __builtin_malloc (sizeof (vectype)); + __transaction_atomic + { + *p = v; + if (c) + __transaction_cancel; + } +} Index: trans-mem.c =================================================================== --- trans-mem.c (revision 182542) +++ trans-mem.c (working copy) @@ -1003,7 +1003,7 @@ tm_log_add (basic_block entry_block, tre special constructors and the like. */ && !TREE_ADDRESSABLE (type)) { - lp->save_var = create_tmp_var (TREE_TYPE (lp->addr), "tm_save"); + lp->save_var = create_tmp_reg (TREE_TYPE (lp->addr), "tm_save"); add_referenced_var (lp->save_var); lp->stmts = NULL; lp->entry_block = entry_block; @@ -1188,6 +1188,7 @@ tm_log_emit_saves (basic_block entry_blo { lp->save_var = make_ssa_name (lp->save_var, stmt); gimple_assign_set_lhs (stmt, lp->save_var); + update_stmt (stmt); } gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);