From patchwork Mon Nov 18 12:39:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1196750 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-513907-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="IGHecODX"; 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 47GpSK5hkNz9sPj for ; Mon, 18 Nov 2019 23:39:45 +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=IbfvXFW7us45hKxxEiL/sWWcRkS8JicES5sRr59qQoX6HsK0cTOqe kwYd5HLfd9eQNOMMs8d6wnDijvZi6kSw3scmAXQoZoKCzJyN3vlC5DCJsyzZPvs0 hJ8mDL48lnjQnBHsok5RNK9ZmlPMLrPPQvcSSJi/C7NXTFJlQPY5M0= 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=4WFvdMcG5lT0DBW9tiZRVTghRh4=; b=IGHecODXez1wC2zXvFdK ksOJtYMqVIZoYK1dHrWSKj808wVSo+j6lL631ZVyd/EVk5PiGJctCU5dBH3MEPd2 Poh37zhFU7M6Mu2HVyV1oi/uBrgO6XbcACECbsKgxOuudfwv+W/jEvlsLPTIeBUU B8VQN40HzLfM4ZzWl6YBxck= Received: (qmail 99307 invoked by alias); 18 Nov 2019 12:39:37 -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 99294 invoked by uid 89); 18 Nov 2019 12:39:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.3 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= 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; Mon, 18 Nov 2019 12:39:36 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 29504B37F for ; Mon, 18 Nov 2019 12:39:34 +0000 (UTC) Date: Mon, 18 Nov 2019 13:39:34 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92558 Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2019-11-18 Richard Biener PR tree-optimization/92558 * tree-vect-loop.c (vect_create_epilog_for_reduction): When reducting the width of a reduction vector def update new_phis. * gcc.dg/vect/pr92558.c: New testcase. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 278389) +++ gcc/tree-vect-loop.c (working copy) @@ -5198,6 +5198,7 @@ vect_create_epilog_for_reduction (stmt_v new_temp = make_ssa_name (vectype1); epilog_stmt = gimple_build_assign (new_temp, code, dst1, dst2); gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT); + new_phis[0] = epilog_stmt; } if (reduce_with_shift && !slp_reduc) Index: gcc/testsuite/gcc.dg/vect/pr92558.c =================================================================== --- gcc/testsuite/gcc.dg/vect/pr92558.c (nonexistent) +++ gcc/testsuite/gcc.dg/vect/pr92558.c (working copy) @@ -0,0 +1,23 @@ +/* { dg-additional-options "-mavx2" { target avx2_runtime } } */ + +void __attribute__((noipa)) +foo (int * __restrict wsum, int * __restrict cff, int * __restrict weight) +{ + for (int i = 0; i < 16; ++i) + { + *wsum += weight[2*i+0]; + *cff += weight[2*i+1]; + } +} + +int main() +{ + int weight[32]; + for (int i = 0; i < 32; ++i) + weight[i] = i; + int wsum = 0, cff = 0; + foo (&wsum, &cff, weight); + if (wsum != 240 || cff != 256) + __builtin_abort (); + return 0; +}