From patchwork Thu May 12 10:19:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 621423 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 3r58Bm0Wscz9s8d for ; Thu, 12 May 2016 20:20:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=Ka5nckgL; 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=Fbs/wh3CjKf4RsHJzy2g+AYUyQLa0si+mGj3aW7fvWGnArpatAe0K SKHS3yQUrMeRDI42gWcbf9ddbWDKJ//fhVx/u7QWfLkvkWvEkULXMjSERNR31O3E r8jbFLZaJCDnurlMuw1DTxSmzjA2VvpCCJIi2w0fqNfMFrz1HBZN2w= 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=Pir1WKXiAggUCUwuc6o9wClTvVE=; b=Ka5nckgLVB4ndKaO3xXG wPQKnoaUehkcAzJnJVN0qjguKvUuBksty5Hh5NdK1bfzjQyqDzae0noWPqHn8mcC dSH1+PdKfh92U2qdVy7mciFh3zIazibXmPhk/ot6mP3u2fxx11Phde/5yjeuEfEE auuqjkiJp0K9p0GD+cjoV6A= Received: (qmail 21467 invoked by alias); 12 May 2016 10:20:16 -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 21446 invoked by uid 89); 12 May 2016 10:20:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1749 X-HELO: mail-wm0-f50.google.com Received: from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 12 May 2016 10:20:05 +0000 Received: by mail-wm0-f50.google.com with SMTP id a17so127555323wme.0 for ; Thu, 12 May 2016 03:20:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=aI2/xMJ0TecVCH3P40vpkgH3ONhr0tPSJ9G44Lbx/h4=; b=lSHuEEXr2xo6HyNRSBaqUA7G/UgITX53SW4OdZoBZM/qS+6VYVC5HIiar3AR9VysOE WaQumuMpYSVhLFhcdeZIXybpOSGf2EoUmUoCQA/PbgBnfGscqanoyQupVbUOF9ArqBb2 17dqAO5ALcYKl2wQyKAPrrfeDQJNzNmtSnRR6kfok/5ZAISAH4V8Qj8wsphfrtQKzTAg ld77m5dDTzxIoQNLzZtIl5yaFUPrhaPNGS/M9T3s4hcqYIz8fkF5vUis+ngpSc9pBh9k HpPRFLRt/cGQbgdNA+neGX7EbE0NDxb38TLsMlsz6k6PTvLnBbpYxm1I8axLhl6riClO eoZg== X-Gm-Message-State: AOPr4FV0ojLuaDSuhh7Z+LhOTBn3cSXpxHcar+lZcV404/8oHNfUR/aa4EqI1UkcIPqWLA== X-Received: by 10.194.204.233 with SMTP id lb9mr8699436wjc.147.1463048402851; Thu, 12 May 2016 03:20:02 -0700 (PDT) Received: from msticlxl57.ims.intel.com (irdmzpr02-ext.ir.intel.com. [192.198.151.37]) by smtp.gmail.com with ESMTPSA id f135sm13064120wmf.22.2016.05.12.03.20.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2016 03:20:02 -0700 (PDT) Date: Thu, 12 May 2016 13:19:01 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, PR tree-optimization/71006] Fix vectype computation for COND_EXPR Message-ID: <20160512101901.GA14664@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes Hi, Currently we have a code in vect_determine_vectorization_factor to compute vectype for mask producers. It wasn't meant to be used for EXPR_COND assignments but it is used now in some cases causing wrong resulting vectype. Bootstrapped and regtested for x86_64-pc-linux-gnu. OK for trunk? Thanks, Ilya --- gcc/ 2016-05-12 Ilya Enkovich PR tree-optimization/71006 * tree-vect-loop.c (vect_determine_vectorization_factor): Don't consider COND_EXPR as a mask producer. gcc/testsuite/ 2016-05-12 Ilya Enkovich PR tree-optimization/71006 * gcc.dg/pr71006.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr71006.c b/gcc/testsuite/gcc.dg/pr71006.c new file mode 100644 index 0000000..2b45aa0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr71006.c @@ -0,0 +1,16 @@ +/* PR target/71006 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-vectorize" } */ + +unsigned char uu, gu, e2; + +void +fs (void) +{ + char *nq = (char *)&gu, *k4 = (char *)&gu; + while (*k4 < 1) + { + uu += (*nq != 0 || e2 != 0); + ++*k4; + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index da98211..d673c67 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -437,7 +437,9 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) /* Bool ops don't participate in vectorization factor computation. For comparison use compared types to compute a factor. */ - if (TREE_CODE (scalar_type) == BOOLEAN_TYPE) + if (TREE_CODE (scalar_type) == BOOLEAN_TYPE + && is_gimple_assign (stmt) + && gimple_assign_rhs_code (stmt) != COND_EXPR) { if (STMT_VINFO_RELEVANT_P (stmt_info)) mask_producers.safe_push (stmt_info);