From patchwork Tue Apr 12 13:38:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 90802 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 9E8D3B6F06 for ; Tue, 12 Apr 2011 23:40:48 +1000 (EST) Received: (qmail 21230 invoked by alias); 12 Apr 2011 13:40:47 -0000 Received: (qmail 21221 invoked by uid 22791); 12 Apr 2011 13:40:46 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, TW_TM X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Apr 2011 13:40:42 +0000 Received: by wye20 with SMTP id 20so6732695wye.20 for ; Tue, 12 Apr 2011 06:40:41 -0700 (PDT) Received: by 10.216.240.71 with SMTP id d49mr3968272wer.0.1302615538338; Tue, 12 Apr 2011 06:38:58 -0700 (PDT) Received: from richards-thinkpad (gbibp9ph1--blueice2n1.emea.ibm.com [195.212.29.75]) by mx.google.com with ESMTPS id l24sm4044442wbc.47.2011.04.12.06.38.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Apr 2011 06:38:57 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, patches@linaro.org, richard.sandiford@linaro.org Cc: patches@linaro.org Subject: [3/9] STMT_VINFO_RELATED_STMT handling in vectorizable_store References: Date: Tue, 12 Apr 2011 14:38:54 +0100 In-Reply-To: (Richard Sandiford's message of "Tue, 12 Apr 2011 14:20:54 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) 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 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. 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? 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);