From patchwork Mon Mar 6 12:05:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 735682 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vcJR72zv5z9sNB for ; Mon, 6 Mar 2017 23:06:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="f2Ah2SJI"; dkim-atps=neutral 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=cNjwxL+2DJ+U/NncwPpuDZei9ngME4nAO+jDMqZBdDWbDoWIoDAvq +J7wDk3NHm43T1P3C7H0pwFh8BqEAgTbH+YQ8E0P2CCJFYJMwcMbU9hkzVEuC1KX Ua5RNwgpqhk1aeWkQlhXMxax3D8nXd+4OFG8z4v+3xTxP8BvQZvDoY= 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=wQc4yePBiYOlAm78omfWGjEb2g8=; b=f2Ah2SJIlYB1hGSmq3tj LrzGBnahS3/43XLGNRiuknZoT7UBvTvbYsoRlmw6EuEjiUPIuuwXnp8RhEXKoPa8 ZSVOiM2TdSee38BhFp7TVGucI+Rrwb74BuS0WSk6CReLDKa3YYbVMpD+g4ujnWuU pN10PVND5dXtYA/Rh7sq3bg= Received: (qmail 29482 invoked by alias); 6 Mar 2017 12:05:58 -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 29403 invoked by uid 89); 6 Mar 2017 12:05:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Mon, 06 Mar 2017 12:05:56 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1839EABCD for ; Mon, 6 Mar 2017 12:05:55 +0000 (UTC) Date: Mon, 6 Mar 2017 13:05:54 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR79887 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 This fixes a crash when we try to re-use a folded loop_vectorized_call when vectorizing an epilogue. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2017-03-06 Richard Biener PR tree-optimization/79894 * tree-vectorizer.c (vectorize_loops): Set loop_vectorized_call to NULL after folding it. * gcc.dg/vect/pr79887.c: New testcase. Index: gcc/tree-vectorizer.c =================================================================== --- gcc/tree-vectorizer.c (revision 245908) +++ gcc/tree-vectorizer.c (working copy) @@ -651,6 +651,7 @@ vectorize_loops (void) "basic block vectorized\n"); fold_loop_vectorized_call (loop_vectorized_call, boolean_true_node); + loop_vectorized_call = NULL; ret |= TODO_cleanup_cfg; } } @@ -703,6 +704,7 @@ vectorize_loops (void) if (loop_vectorized_call) { fold_loop_vectorized_call (loop_vectorized_call, boolean_true_node); + loop_vectorized_call = NULL; ret |= TODO_cleanup_cfg; } Index: gcc/testsuite/gcc.dg/vect/pr79887.c =================================================================== --- gcc/testsuite/gcc.dg/vect/pr79887.c (nonexistent) +++ gcc/testsuite/gcc.dg/vect/pr79887.c (working copy) @@ -0,0 +1,14 @@ +/* Test for pr79887. */ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_condition } */ +/* { dg-additional-options "-fno-trapping-math --param vect-epilogues-nomask=1" } */ +/* { dg-additional-options "-mavx512ifma" { target x86_64-*-* i?86-*-* } } */ + +void +foo (float a[32], float b[2][32]) +{ + int i; + for (i = 0; i < 32; i++) + a[i] = (b[0][i] > b[1][i]) ? b[0][i] : b[1][i]; +} +