From patchwork Tue Jul 24 09:53:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 948286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-482113-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fsMw2icq"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ZYb22c5Kz9s3N for ; Tue, 24 Jul 2018 19:53:34 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=BVYAUEHdAPtinvwYnjUN0Z+uy7Vlv ErBf4B3h3/s7NR8sVeXTgVFrY61o1ME2uOf1T1Vzv2SfCJ3hMKb04QnjlbQbT2GQ HOakfE1GOxrtkJbffpGbaaD0h37wLYpp7PXx6LCAc59/5gTEJ0Ew6B8IKLBuIXmz nRbJ8FlvwQdCNs= 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:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=IuvOIl9UYsrEsBtAbKJlQmCwZKc=; b=fsM w2icqRy7Eh4EpkXPdX025NMk9d+84Ksfk7dQNgJ8fGATiO2z13ql5juh4z18x8w+ CASzVxIyHgznyaWtgG/y6J9yuiqG3QI2V5h5SukvaXFT4F/cJpbQzZt1WILaqFjx eC5KDiroTKEPg/j8QfYyDN6fQx2WgdUcxrdjz/uI= Received: (qmail 116747 invoked by alias); 24 Jul 2018 09:53: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 116736 invoked by uid 89); 24 Jul 2018 09:53:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jul 2018 09:53:25 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 029FC7A9 for ; Tue, 24 Jul 2018 02:53:24 -0700 (PDT) Received: from localhost (unknown [10.32.99.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7FAAB3F237 for ; Tue, 24 Jul 2018 02:53:23 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [02/46] Remove dead vectorizable_reduction code References: <87wotlrmen.fsf@arm.com> Date: Tue, 24 Jul 2018 10:53:21 +0100 In-Reply-To: <87wotlrmen.fsf@arm.com> (Richard Sandiford's message of "Tue, 24 Jul 2018 10:52:16 +0100") Message-ID: <87o9exrmcu.fsf@arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 vectorizable_reduction has old code to cope with cases in which the given statement belongs to a reduction group but isn't the first statement. That can no longer happen, since all statements in the group go into the same SLP node, and we only check the first statement in each node. The point is to remove the only path through vectorizable_reduction in which stmt and stmt_info refer to different statements. 2018-07-24 Richard Sandiford gcc/ * tree-vect-loop.c (vectorizable_reduction): Assert that the function is not called for second and subsequent members of a reduction group. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c 2018-07-24 10:22:02.965552667 +0100 +++ gcc/tree-vect-loop.c 2018-07-24 10:22:06.269523330 +0100 @@ -6162,7 +6162,6 @@ vectorizable_reduction (gimple *stmt, gi auto_vec phis; int vec_num; tree def0, tem; - bool first_p = true; tree cr_index_scalar_type = NULL_TREE, cr_index_vector_type = NULL_TREE; tree cond_reduc_val = NULL_TREE; @@ -6178,15 +6177,8 @@ vectorizable_reduction (gimple *stmt, gi nested_cycle = true; } - /* In case of reduction chain we switch to the first stmt in the chain, but - we don't update STMT_INFO, since only the last stmt is marked as reduction - and has reduction properties. */ - if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) - && REDUC_GROUP_FIRST_ELEMENT (stmt_info) != stmt) - { - stmt = REDUC_GROUP_FIRST_ELEMENT (stmt_info); - first_p = false; - } + if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) + gcc_assert (slp_node && REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt); if (gimple_code (stmt) == GIMPLE_PHI) { @@ -7050,8 +7042,7 @@ vectorizable_reduction (gimple *stmt, gi if (!vec_stmt) /* transformation not required. */ { - if (first_p) - vect_model_reduction_cost (stmt_info, reduc_fn, ncopies, cost_vec); + vect_model_reduction_cost (stmt_info, reduc_fn, ncopies, cost_vec); if (loop_vinfo && LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo)) { if (reduction_type != FOLD_LEFT_REDUCTION