From patchwork Mon Oct 21 13:41:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1180612 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-511427-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="i3+guXcE"; 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 46xd8q1cTcz9sRC for ; Tue, 22 Oct 2019 00:41: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=CB9bjEm5XPU81fkAAPp0sajBhEc+9953EoxaT8ldoclv6eA4ZZ+e+ wMoAnZCPn+r/EUPLIzOs4tyHakVXsaNBt8pwBLydjR8mbONwW6rN3IZUSo/yl5il cLBpFDGBM4xmZD8EmmLCNuG6COxwjx4XkAtwBwDMh7oK/4CE/3fpZA= 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=EIcUJflPJByfNng4viNi91MrL/w=; b=i3+guXcEOlRITVFzJ3WC AHAfxdH1GmfFlkpK2glhE7KTP0CSMWJSzZnsLa2a0RZ+KCv1/X9hMoale0oEOax+ S+mTEJbe4D2RPWOtOD8vjVHpidkVVXz8xDkfAMsW4wHO5J2yF+tP5ozVVwwmo+rO VHI13HeLm3IEe2d3AGlvvSE= Received: (qmail 103805 invoked by alias); 21 Oct 2019 13:41:38 -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 103454 invoked by uid 89); 21 Oct 2019 13:41:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=mirror, HX-Languages-Length:1993 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, 21 Oct 2019 13:41:35 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DFC58B161 for ; Mon, 21 Oct 2019 13:41:32 +0000 (UTC) Date: Mon, 21 Oct 2019 15:41:32 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92162 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-10-21 Richard Biener PR tree-optimization/92162 * tree-vect-loop.c (vect_create_epilog_for_reduction): Lookup STMT_VINFO_REDUC_IDX in reduc_info. * tree-vect-stmts.c (vectorizable_condition): Likewise. * gcc.dg/pr92162.c: New testcase. Index: gcc/testsuite/gcc.dg/pr92162.c =================================================================== --- gcc/testsuite/gcc.dg/pr92162.c (nonexistent) +++ gcc/testsuite/gcc.dg/pr92162.c (working copy) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Ofast" } */ + +short int s8; + +void __attribute__ ((simd)) +gn (void) +{ + s8 = 0; +} Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 277242) +++ gcc/tree-vect-loop.c (working copy) @@ -4259,9 +4259,9 @@ vect_create_epilog_for_reduction (stmt_v (CCOMPARE). The then and else values mirror the main VEC_COND_EXPR: the reduction phi corresponds to NEW_PHI_TREE and the new values correspond to INDEX_BEFORE_INCR. */ - gcc_assert (STMT_VINFO_REDUC_IDX (stmt_info) >= 1); + gcc_assert (STMT_VINFO_REDUC_IDX (reduc_info) >= 1); tree index_cond_expr; - if (STMT_VINFO_REDUC_IDX (stmt_info) == 2) + if (STMT_VINFO_REDUC_IDX (reduc_info) == 2) index_cond_expr = build3 (VEC_COND_EXPR, cr_index_vector_type, ccompare, indx_before_incr, new_phi_tree); else Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 277242) +++ gcc/tree-vect-stmts.c (working copy) @@ -9818,7 +9818,7 @@ vectorizable_condition (stmt_vec_info st return false; reduc_info = info_for_reduction (stmt_info); reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info); - reduc_index = STMT_VINFO_REDUC_IDX (stmt_info); + reduc_index = STMT_VINFO_REDUC_IDX (reduc_info); gcc_assert (reduction_type != EXTRACT_LAST_REDUCTION || reduc_index != -1); }