From patchwork Fri Jul 12 12:40:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1131352 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-505005-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="YHQpJ6mZ"; 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 45lXZx47PWz9sSD for ; Fri, 12 Jul 2019 22:40:38 +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:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=bjq4PRcP4Ylbg5wBsZFoXU4JhiBIkD8wbUUwYGBWIU9Fb9vzXH4n8 RaswIsMuKeI/I04wNP0xkQYoJHA6yyijJ9MyC0WuyT2LVk3WTArFWUEtslMcDGXS ZlRnxyt3mCV/Mm2+VT1yjbfOYBXZt0r8eJ7XbUOqXgqKNcGRQqBUtA= 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=IWLZmNxpRfbrOBqg28rQ0cFuM8I=; b=YHQpJ6mZFAcmEgn8nZ/t JCzGx28GpYsaHTqOOfOXVxVtm8IEvgS4WQGPe5WSC5wtsh0D2xzloBFj4FhLHGm/ Gp+eLibke3dSnj3A56hI9aBaxJDu3+0agnndF2OQWKRy17AxmbLkKo3EW5S9gKoJ kIvVZbUFVqATef9ZNtwM96g= Received: (qmail 74091 invoked by alias); 12 Jul 2019 12:40:31 -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 74083 invoked by uid 89); 12 Jul 2019 12:40:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1403 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; Fri, 12 Jul 2019 12:40:21 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1457AAB91 for ; Fri, 12 Jul 2019 12:40:19 +0000 (UTC) Date: Fri, 12 Jul 2019 14:40:19 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR91145 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 The following fixes the PR. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2019-07-12 Richard Biener PR tree-optimization/91145 * tree-vect-slp.c (vect_build_slp_tree_2): Fix reduction chain check. * gcc.dg/torture/pr91145.c: New testcase. Index: gcc/testsuite/gcc.dg/torture/pr91145.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr91145.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr91145.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } } */ + +int a, c; +unsigned b, e; +extern unsigned d[100]; + +void f() +{ + for (int g = 0; g < 70; g++) + { + + b += d[g] - c; + e -= g ^ a; + } +} Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c (revision 273433) +++ gcc/tree-vect-slp.c (working copy) @@ -1140,7 +1140,8 @@ vect_build_slp_tree_2 (vec_info *vinfo, FOR_EACH_VEC_ELT (stmts, i, other_info) { /* But for reduction chains only check on the first stmt. */ - if (REDUC_GROUP_FIRST_ELEMENT (other_info) + if (!STMT_VINFO_DATA_REF (other_info) + && REDUC_GROUP_FIRST_ELEMENT (other_info) && REDUC_GROUP_FIRST_ELEMENT (other_info) != stmt_info) continue; if (STMT_VINFO_DEF_TYPE (other_info) != def_type)