From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35804 invoked by alias); 31 May 2019 10:53:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 35647 invoked by uid 89); 31 May 2019 10:53:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1921 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; Fri, 31 May 2019 10:53:08 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 80AC6AD05; Fri, 31 May 2019 10:53:06 +0000 (UTC) Date: Fri, 31 May 2019 11:32:00 -0000 From: Richard Biener To: Jakub Jelinek cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Handle "omp simd array" accesses in ifcvt_memrefs_wont_trap In-Reply-To: <20190531095729.GG19695@tucnak> Message-ID: References: <20190531093323.GF19695@tucnak> <20190531095729.GG19695@tucnak> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="-1609908220-1311659437-1559299986=:10704" X-SW-Source: 2019-05/txt/msg02119.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---1609908220-1311659437-1559299986=:10704 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT Content-length: 1921 On Fri, 31 May 2019, Jakub Jelinek wrote: > On Fri, May 31, 2019 at 11:43:29AM +0200, Richard Biener wrote: > > Hmm. Is it enough to set TREE_THIS_NOTRAP on the ARRAY_REF instead? > > That works too. > > > At least it's documented the ARRAY_REF then isn't the issue. > > As for conditional vs. unconditional I'm not so sure but automatic > > vars are excepmted from that anyways? > > Only if they are guaranteed not to have out of bound accesses. > > Anyway, I'll go with this, those ARRAY_REFs indeed should never trap. Thanks - a lot simpler indeed ;) Richard. > 2019-05-31 Jakub Jelinek > > * omp-low.c (lower_rec_simd_input_clauses): Set TREE_THIS_NOTRAP on > ivar and lvar. > > * gcc.dg/vect/vect-cond-12.c: New test. > > --- gcc/omp-low.c.jj 2019-05-30 23:19:14.469931759 +0200 > +++ gcc/omp-low.c 2019-05-31 11:52:20.491195088 +0200 > @@ -3728,6 +3728,8 @@ lower_rec_simd_input_clauses (tree new_v > NULL_TREE, NULL_TREE); > lvar = build4 (ARRAY_REF, TREE_TYPE (new_var), avar, sctx->lane, > NULL_TREE, NULL_TREE); > + TREE_THIS_NOTRAP (ivar) = 1; > + TREE_THIS_NOTRAP (lvar) = 1; > } > if (DECL_P (new_var)) > { > --- gcc/testsuite/gcc.dg/vect/vect-cond-12.c.jj 2019-05-31 11:25:33.203577504 +0200 > +++ gcc/testsuite/gcc.dg/vect/vect-cond-12.c 2019-05-31 11:26:58.616174115 +0200 > @@ -0,0 +1,14 @@ > +/* { dg-do compile } */ > +/* { dg-additional-options "-fopenmp-simd" } */ > +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */ > + > +int x; > + > +void > +foo (int *a) > +{ > + #pragma omp simd lastprivate (x) > + for (int i = 0; i < 1024; ++i) > + if (a[i]) > + x = i; > +} > > > Jakub > -- Richard Biener SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer, Mary Higgins, Sri Rasiah; HRB 21284 (AG Nürnberg) ---1609908220-1311659437-1559299986=:10704--