From patchwork Mon Dec 2 10:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1203094 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-514949-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="a3rbz9xd"; 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 47RMLl1nNFz9sPc for ; Mon, 2 Dec 2019 21:49:35 +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=Hhbd12hBkGBxa0qz/FxHP/T7Nvol6V4/VbNQHsSZt4MMoMOXPNzNc 5HIdFuKRnBc1m/T2LnhvDP44hr0gr1ytYl7GW4FBfPd1yi/Zy3UPJrjryb1cM0Pt xm3lMCrodp1cfrW0e4dXaniwq8TtCAjzGm18dbddyQUbYuPehnbrug= 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=yv/O6u33Fh5SrzvI6UUypJCfTAQ=; b=a3rbz9xdwuc2V1Q/03Cu yxiU3/dW6v9fFHx/a1G2RX0nzdhwfRFhhSh8K9YAST4qotYmcme0BmNg2D5ZUJGY lXNZHzs5wJUtTz2Lz+a+FV0QIH2p8d/Fhgv2yWSTFJnOfzvsfzkq1c2cE+WDV736 NDOHT3v3+A6JoDht+Q4oXZ8= Received: (qmail 55733 invoked by alias); 2 Dec 2019 10:49:27 -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 55723 invoked by uid 89); 2 Dec 2019 10:49:27 -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, 02 Dec 2019 10:49:26 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1CE30ABEA for ; Mon, 2 Dec 2019 10:49:24 +0000 (UTC) Date: Mon, 2 Dec 2019 11:49:24 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR92742 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-12-02 Richard Biener PR tree-optimization/92742 * tree-vect-loop.c (vect_fixup_reduc_chain): Do not touch the def-type but verify it is consistent with the original stmts. * gcc.dg/torture/pr92742.c: New testcase. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c (revision 278893) +++ gcc/tree-vect-loop.c (working copy) @@ -643,6 +643,8 @@ vect_fixup_reduc_chain (stmt_vec_info st do { stmtp = STMT_VINFO_RELATED_STMT (stmt_info); + gcc_checking_assert (STMT_VINFO_DEF_TYPE (stmtp) + == STMT_VINFO_DEF_TYPE (stmt_info)); REDUC_GROUP_FIRST_ELEMENT (stmtp) = firstp; stmt_info = REDUC_GROUP_NEXT_ELEMENT (stmt_info); if (stmt_info) @@ -650,7 +652,6 @@ vect_fixup_reduc_chain (stmt_vec_info st = STMT_VINFO_RELATED_STMT (stmt_info); } while (stmt_info); - STMT_VINFO_DEF_TYPE (stmtp) = vect_reduction_def; } /* Fixup scalar cycles that now have their stmts detected as patterns. */ Index: gcc/testsuite/gcc.dg/torture/pr92742.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr92742.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr92742.c (working copy) @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-vectorize" } */ + +unsigned int qw; + +int +rs (int iq, int wg) +{ + for (qw = 0; qw < 2; ++qw) + { + } + + while (iq < 1) + { + wg *= qw * 2; + ++iq; + } + + return wg; +}