From patchwork Thu May 11 14:06:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 761089 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 3wNvzw10jvz9sDC for ; Fri, 12 May 2017 00:06:51 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="qwG6GOcV"; 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=gF8EhsTYZxY03bvA0tl/OUbOSe0PqcwhqUxQhAZlfG25FJJrKsZTc WOW47y5J8Z/b8HT8CFmbhy2lrISct7YEXr66xEW4namKLmGGJdmGT5XdhtHKgVZf adaTZsspgtpO9P1g6iO5Q/onEx1gXKvJRIFbNBCzHn1UNBlxVup/PY= 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=K7NkEnGTLD4nBdZ/2JuDbIw1OCQ=; b=qwG6GOcVI7Hf3r85SJap xFsaLa522i5WyJWaGoDmXCunbWVHT+0GH5lcN4v6E65KO/6UP3pojvn4WyRVvt+v 96SVs1yQRHZaneWAtDURHRSyCVgOpJII6sUeQyX5lVQcxG0ZgcbgwViaCkj8yhZG T+3SrOLwn08oA+SkoE9VvaM= Received: (qmail 103883 invoked by alias); 11 May 2017 14:06:41 -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 103865 invoked by uid 89); 11 May 2017 14:06:40 -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=txt 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; Thu, 11 May 2017 14:06:35 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D6E32ABCA for ; Thu, 11 May 2017 14:06:35 +0000 (UTC) Date: Thu, 11 May 2017 16:06:35 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR80705 Message-ID: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2017-05-11 Richard Biener PR tree-optimization/80705 * tree-vect-data-refs.c (vect_analyze_data_refs): DECL_NONALIASED bases are not vectorizable. * gcc.dg/vect/bb-slp-pr80705.c: New testcase. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c (revision 247881) +++ gcc/tree-vect-data-refs.c (working copy) @@ -3957,6 +3957,27 @@ again: datarefs[i] = dr; } + if (TREE_CODE (DR_BASE_ADDRESS (dr)) == ADDR_EXPR + && VAR_P (TREE_OPERAND (DR_BASE_ADDRESS (dr), 0)) + && DECL_NONALIASED (TREE_OPERAND (DR_BASE_ADDRESS (dr), 0))) + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "not vectorized: base object not addressable " + "for stmt: "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); + } + if (is_a (vinfo)) + { + /* In BB vectorization the ref can still participate + in dependence analysis, we just can't vectorize it. */ + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + continue; + } + return false; + } + /* Set vectype for STMT. */ scalar_type = TREE_TYPE (DR_REF (dr)); STMT_VINFO_VECTYPE (stmt_info) Index: gcc/testsuite/gcc.dg/vect/bb-slp-pr80705.c =================================================================== --- gcc/testsuite/gcc.dg/vect/bb-slp-pr80705.c (revision 0) +++ gcc/testsuite/gcc.dg/vect/bb-slp-pr80705.c (working copy) @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-require-profiling "-fprofile-generate" } */ +/* { dg-additional-options "-fprofile-generate" } */ + +extern int isspace (int); + +int foo(const char *txt, char *buf) +{ + const char *s; + char *d; + int ws = 1; + for (s=txt, d=buf; *s; ) + { + if (*s=='/' && *(s+1)=='/') { + + s += 2; + while (*s && *s!='\r' && *s!='\n') + s++; + } + else if (*s=='"') { + + s++; + while (*s && *s!='\r' && *s!='\n' && *s!='"') + if (*s++=='\\') + s++; + if (*s=='"') + s++; + } + else { + if (*s && !isspace(*s)) + ws = 0; + + + *d++ = *s++; + + } + } + *d = '\0'; + + return ws; +} + +/* { dg-final { scan-tree-dump "base object not addressable" "slp1" } } */ +/* { dg-final { scan-tree-dump-not "MEM\[^\r\n\]*__gcov\[^\r\n\]* = vect_cst" "slp1" } } */