From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22505 invoked by alias); 17 Apr 2011 10:18:14 -0000 Received: (qmail 22492 invoked by uid 22791); 17 Apr 2011 10:18:13 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,TW_TM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate4.uk.ibm.com (HELO mtagate4.uk.ibm.com) (194.196.100.164) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Apr 2011 10:17:59 +0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p3HAHtja017821 for ; Sun, 17 Apr 2011 10:17:55 GMT Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p3HAIlBq1896604 for ; Sun, 17 Apr 2011 11:18:49 +0100 Received: from d06av07.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p3HAHrkU032181 for ; Sun, 17 Apr 2011 04:17:53 -0600 Received: from d12mc102.megacenter.de.ibm.com (d12mc102.megacenter.de.ibm.com [9.149.167.114]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p3HAHr0h032168; Sun, 17 Apr 2011 04:17:53 -0600 In-Reply-To: References: Subject: Re: [3/9] STMT_VINFO_RELATED_STMT handling in vectorizable_store X-KeepSent: 10FE96BC:623FAAA5-C2257875:00336E91; type=4; name=$KeepSent To: Richard Sandiford Cc: gcc-patches@gcc.gnu.org, patches@linaro.org Message-ID: From: Ira Rosen Date: Sun, 17 Apr 2011 10:25:00 -0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg01302.txt.bz2 gcc-patches-owner@gcc.gnu.org wrote on 12/04/2011 04:38:54 PM: > vectorizable_store contains the code: > > for (j = 0; j < ncopies; j++) > { > for (i = 0; i < vec_num; i++) > { > ... > if (j == 0) > STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; > else > STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; > prev_stmt_info = vinfo_for_stmt (new_stmt); > } > } > > That is, STMT_VINFO_VEC_STMT (stmt_info) and *vec_stmt contain the last > statement emitted for the _last_ vector of the first copy. However, > for later copies, the last statement for _every_ vector is chained using > STMT_VINFO_RELATED_STMT. This seems a bit inconsistent, and isn't > what I expected from the comments. It also seems different from > other vectorisation functions, where each copy has exactly one > STMT_VINFO_RELATED_STMT. I wasn't sure whether the difference here > was deliberate or not. I think it doesn't really matter because STMT_VINFO_RELATED_STMT is used for retrieving copies of vector operands, and stores don't define any. > > The reason I'm changing it is that it makes the control flow for > the new code more obvious. > > Tested on x86_64-linux-gnu and arm-linux-gnueabi. OK to install? OK. Thanks, Ira > > Richard > > > gcc/ > * tree-vect-stmts.c (vectorizable_store): Only chain one related > statement per copy. > > Index: gcc/tree-vect-stmts.c > =================================================================== > --- gcc/tree-vect-stmts.c 2011-04-12 11:55:08.000000000 +0100 > +++ gcc/tree-vect-stmts.c 2011-04-12 11:55:09.000000000 +0100 > @@ -3612,6 +3612,7 @@ vectorizable_store (gimple stmt, gimple_ > > if (1) > { > + new_stmt = NULL; > if (strided_store) > { > result_chain = VEC_alloc (tree, heap, group_size); > @@ -3669,17 +3670,19 @@ vectorizable_store (gimple stmt, gimple_ > if (slp) > continue; > > - if (j == 0) > - STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; > - else > - STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; > - > - prev_stmt_info = vinfo_for_stmt (new_stmt); > next_stmt = DR_GROUP_NEXT_DR (vinfo_for_stmt (next_stmt)); > if (!next_stmt) > break; > } > } > + if (!slp) > + { > + if (j == 0) > + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; > + else > + STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; > + prev_stmt_info = vinfo_for_stmt (new_stmt); > + } > } > > VEC_free (tree, heap, dr_chain);