From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 87352 invoked by alias); 17 Dec 2015 14:22:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 86056 invoked by uid 89); 17 Dec 2015 14:22:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2727 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 17 Dec 2015 14:22:33 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 71F64AAC1 for ; Thu, 17 Dec 2015 14:22:30 +0000 (UTC) Date: Thu, 17 Dec 2015 14:22:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR68946 Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2015-12/txt/msg01769.txt.bz2 This fixes PR68946. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2015-12-17 Richard Biener PR tree-optimization/68946 * tree-vect-slp.c (vect_slp_analyze_node_operations): Push SLP def type to stmt operands one stmt at a time. * gcc.dg/torture/pr68946.c: New testcase. Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c (revision 231745) +++ gcc/tree-vect-slp.c (working copy) @@ -2221,12 +2250,6 @@ vect_slp_analyze_node_operations (slp_tr if (!vect_slp_analyze_node_operations (child)) return false; - /* Push SLP node def-type to stmts. */ - FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - if (SLP_TREE_DEF_TYPE (child) != vect_internal_def) - FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt) - STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = SLP_TREE_DEF_TYPE (child); - bool res = true; FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) { @@ -2234,19 +2257,21 @@ vect_slp_analyze_node_operations (slp_tr gcc_assert (stmt_info); gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect); - if (!vect_analyze_stmt (stmt, &dummy, node)) - { - res = false; - break; - } + /* Push SLP node def-type to stmt operands. */ + FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child) + if (SLP_TREE_DEF_TYPE (child) != vect_internal_def) + STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[i])) + = SLP_TREE_DEF_TYPE (child); + res = vect_analyze_stmt (stmt, &dummy, node); + /* Restore def-types. */ + FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child) + if (SLP_TREE_DEF_TYPE (child) != vect_internal_def) + STMT_VINFO_DEF_TYPE (vinfo_for_stmt (SLP_TREE_SCALAR_STMTS (child)[i])) + = vect_internal_def; + if (! res) + break; } - /* Restore stmt def-types. */ - FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - if (SLP_TREE_DEF_TYPE (child) != vect_internal_def) - FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (child), j, stmt) - STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = vect_internal_def; - return res; } Index: gcc/testsuite/gcc.dg/torture/pr68946.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr68946.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr68946.c (working copy) @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fno-vect-cost-model" } */ + +int printf (const char *, ...); + +int a, b, g; +short c, e, h, i; +int f[8]; +void fn1() { + short j; + for (; a;) { + printf("%d", g); + b = 7; + for (; b >= 0; b--) { + i = 1; + short k = f[b]; + e = k ? k : 3; + j = (i && (c |= e)) << 3; + int l = j, m = 0; + h = l < 0 || l >> m; + f[b] = h; + } + } +}