From patchwork Thu Mar 1 18:20:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 130379 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3125925edc; Thu, 1 Mar 2018 10:20:18 -0800 (PST) X-Google-Smtp-Source: AG47ELux0XnHpN5JCbkJE91q9nMA+sorqjoXWXQirHAklbNDBcO4rg+phZzCbN3IPhL1JXlBbxI1 X-Received: by 10.98.194.87 with SMTP id l84mr2857326pfg.6.1519928418263; Thu, 01 Mar 2018 10:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519928418; cv=none; d=google.com; s=arc-20160816; b=G2HKJzUxeK89EIImsZ9xMNq666Eqwtpxsga6JyJncREruh8+DA/n3tpw2f5KEauwgy SCpXo8beRHk/gW3Sxl4p2ZNpnBxrd3e0qG/uzVncuf66bL/QuzmDBbSL/EErQm/1V4Ir tHpnDKse991NFGlAPljyPHE/LCj2cbr8a/bpRXWWOI/J883tG6GUtaFji+x+32da77G1 JllNQyNGQYq5/9XiAX4IKhMXYEKdzowC++K9Reg8FC/JZ1K4T6fQ64eVhz8UpMvqCwYA /1+B3JPPBSbI/Ta3w0yE8HMUHDWREG2zxu/E31W2dMmrXPtHClh4bYzMO1Ev/b/jE2xO Hcqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=3DEt7WttGw0H0o5aWrX5BEwfuesTbpiQhiWP9+kct6A=; b=xIwAgMtzU4EIwA0r2/Mws9UlwBFnJfVaoFaGjE0QnyC36rKtYdqPip3vpLdB6tsh6I bnH/q9kkhBVKySYV3r0S+/r/xEkDE3Y4JZiycfgrrhdpvdzdR+J2CLzO/ZhUxiUcn6hv CFvse38C5Oz2UASOEVrwxiH0bjHdsnnl+tFxDMWXeFM4qvdWPgyozzhxnMIFOx9s020f PU9RCusIbUaGv4f7XT3eIaUeMDjXLbM2FHnUnwnk4JD7v3TjVN/vkF2KU2qQ/LsqYFDn mpeWkqn79wqrhB9Wz0v9AvIdxMr4lmDfLfsdL2xVpOeLP4+tL5/mjSvAhXArfKSDteQl sqwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WHZbsWGD; spf=pass (google.com: domain of gcc-patches-return-474103-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-474103-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id b7si2756558pgv.634.2018.03.01.10.20.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 10:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-474103-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=WHZbsWGD; spf=pass (google.com: domain of gcc-patches-return-474103-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-474103-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=JLTNn0fu4x6Y+maMOCzSzl9LETWrumDoB6X4oYrVpHdw1kQtgcUeR fJgvHmO3RsjV7asPCfudi1Fz8PCWcfIEpOJl+I+IiRJVo0yrYdNIq4geZQZWX2Z6 HyznWkSEEsL22g5elnLIf7jkwES74Ly+2vslXr4HAeaHv1Q8W+ZrJU= 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:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=HxX30sD+YPVSBML5B7kMw3EuVDw=; b=WHZbsWGDpmJO2YrgE/Si MxNjwSes1JE8yfSlQmygeX16DDZyevXKLU+A2hgGoquRsxyeisgQZZGVksU4yMWM OjEscIAhDzJIWgx3RI9NlUzr8N68f+hMyO/Ofxme4saiEAlMFbayNQgT/wTOmZM+ s2rtY5vOo5aJzCTq0h98FOM= Received: (qmail 58984 invoked by alias); 1 Mar 2018 18:20:07 -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 58975 invoked by uid 89); 1 Mar 2018 18:20:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=VECTORIZED, HX-Received:10.28.87.211 X-HELO: mail-wm0-f46.google.com Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Mar 2018 18:20:04 +0000 Received: by mail-wm0-f46.google.com with SMTP id w128so13997209wmw.0 for ; Thu, 01 Mar 2018 10:20:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:date:message-id :user-agent:mime-version; bh=3DEt7WttGw0H0o5aWrX5BEwfuesTbpiQhiWP9+kct6A=; b=Pf4E/8tBv9eVWKNX6RRt0k2F/IB/kt8SuGCG+XWatHNYcIVKgqP/Fdft1qJScxg2Ft 1hBBBuvfydSL2w8QYNiKgXOeGrASP8MJm1jG7H30MaFpXfs0XhUNEGbzTKnLBRq5XXHE XBGXxTzjy3qtudm3aFlvofUkMVFhvEgP9NJTLs3HwhQYxx3fGrF0eg8p9Vs2dAyONCWw mv9QHQQEyPT4HbWM41B8ugFymj23O4S1nwB2NRMos9NgcvL10ULihuvyVK3ql51engdx /awGlbiuXL5beQ5WoMTT1zPZ4/pLnlXApj2hLoy/utw6Tk5O7f+ffyd3IeBUEF4YQrBr dkjQ== X-Gm-Message-State: AElRT7FOn8wIyHVw4RCjj8twrfexcWvN3Ij9SbFvHSGNHBt4o0mbMGdL MHRAg/e5nU0FlDbHvMun3gMovOAFG7k= X-Received: by 10.28.87.211 with SMTP id l202mr2380354wmb.32.1519928402339; Thu, 01 Mar 2018 10:20:02 -0800 (PST) Received: from localhost ([217.140.96.141]) by smtp.gmail.com with ESMTPSA id e191sm4193907wmg.12.2018.03.01.10.20.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Mar 2018 10:20:01 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Use loop->safelen rather than loop->force_vectorize Date: Thu, 01 Mar 2018 18:20:00 +0000 Message-ID: <87tvtz8xpr.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 ...since the latter doesn't guarantee independence by itself. Tested on aarch64-linux-gnu. OK to install? Richard 2018-03-01 Richard Sandiford gcc/ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence) (vect_analyze_data_ref_access): Use loop->safe_len rather than loop->force_vectorize to check whether there is no alias. gcc/testsuite/ * gcc.dg/vect/vect-alias-check-13.c: New test. Index: gcc/tree-vect-data-refs.c =================================================================== --- gcc/tree-vect-data-refs.c 2018-02-10 09:49:47.950776097 +0000 +++ gcc/tree-vect-data-refs.c 2018-03-01 18:17:41.631482331 +0000 @@ -466,7 +466,7 @@ vect_analyze_data_ref_dependence (struct return true; } - if (!loop->force_vectorize) + if (loop->safelen < 2) { tree indicator = dr_zero_step_indicator (dra); if (TREE_CODE (indicator) != INTEGER_CST) @@ -2720,7 +2720,7 @@ vect_analyze_data_ref_access (struct dat /* Allow references with zero step for outer loops marked with pragma omp simd only - it guarantees absence of loop-carried dependencies between inner loop iterations. */ - if (!loop->force_vectorize) + if (loop->safelen < 2) { if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, Index: gcc/testsuite/gcc.dg/vect/vect-alias-check-13.c =================================================================== --- /dev/null 2018-03-01 08:17:49.562264353 +0000 +++ gcc/testsuite/gcc.dg/vect/vect-alias-check-13.c 2018-03-01 18:17:41.630484279 +0000 @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +void +f1 (int *x, long step1, int n) +{ + for (int i = 0; i < n; ++i) + x[i * step1] += 1; +} + +void +f2 (int *x, long step2, int n) +{ +#pragma GCC ivdep + for (int i = 0; i < n; ++i) + x[i * step2] += 2; +} + +/* { dg-final { scan-tree-dump {need run-time check that [^\n]*step1[^\n]* is nonzero} "vect" } } */ +/* { dg-final { scan-tree-dump-not {need run-time check that [^\n]*step2[^\n]* is nonzero} "vect" } } */ +/* { dg-final { scan-tree-dump-times {LOOP VECTORIZED} 2 "vect" } } */