From patchwork Thu Nov 7 11:47:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1191100 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512696-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="x4qqofXI"; 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 4781qW0pc4z9sP3 for ; Thu, 7 Nov 2019 22:47:49 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=aaat9YqdKJLtT7L2h3ScOrGDDRu9P2WunlNDmOba5ZlIA/A+rEc2M 87IV05O+CKx5c4ZNA9cxQpSIDWAZWZ0C4uBhp3AghxJz7bxmMtCKlPOItdg8TqVz EmLlzc3tIRTWsOh3zviypNsCvVEhhy0mN4jB3Hbao6O/t1M5Q6XCqE= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=HM9Pybws9PPM/GPsLj1D4ZvmohM=; b=x4qqofXIvaKZSRLv9bMW LbjwMDHj+cdwtOEIpj0ehtWLEJNAjdyndbL+XEjLnzIGlTwxZgvH3Wjld+SrP41u UX/2ARAwIsJHuPwrmkgxn7w4uNlW2su3fkYYSpm2V8fFLKYrs8uCAWrUrkJ9qkQN BiQjZM0tFyAnjmoeyoJn2vc= Received: (qmail 18733 invoked by alias); 7 Nov 2019 11:47:41 -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 18720 invoked by uid 89); 7 Nov 2019 11:47:41 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1006 X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Nov 2019 11:47:39 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8AF53AD49 for ; Thu, 7 Nov 2019 11:47:37 +0000 (UTC) Date: Thu, 7 Nov 2019 12:47:37 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92405 Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Bootstrapped & tested on x86_64-unknown-linux-gnu, applied. Richard. 2019-11-07 Richard Biener PR tree-optimization/92405 * tree-vect-loop.c (vectorizable_reduction): Appropriately restrict lane-reducing ops to single stmt chains. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 277907) +++ gcc/tree-vect-loop.c (working copy) @@ -5865,6 +5865,18 @@ vectorizable_reduction (stmt_vec_info st reduc_chain_length++; } + /* For lane-reducing ops we're reducing the number of reduction PHIs + which means the only use of that may be in the lane-reducing operation. */ + if (lane_reduc_code_p + && reduc_chain_length != 1 + && !only_slp_reduc_chain) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "lane-reducing reduction with extra stmts.\n"); + return false; + } + reduc_def = PHI_RESULT (reduc_def_phi); for (i = 0; i < op_type; i++) {