From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76322 invoked by alias); 1 Jun 2016 13:39:01 -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 76242 invoked by uid 89); 1 Jun 2016 13:39:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:lists, chung-lin, DECL_P, Chung-Lin X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Jun 2016 13:38:50 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4607BC049D5B; Wed, 1 Jun 2016 13:38:49 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u51DclLn018730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 1 Jun 2016 09:38:48 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u51DcjpV023729; Wed, 1 Jun 2016 15:38:45 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u51DcgL5016663; Wed, 1 Jun 2016 15:38:42 +0200 Date: Wed, 01 Jun 2016 13:39:00 -0000 From: Jakub Jelinek To: Chung-Lin Tang Cc: Thomas Schwinge , Cesar Philippidis , gcc-patches Subject: Re: [PATCH, OpenACC] Make reduction arguments addressable Message-ID: <20160601133842.GQ28550@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20160530165341.GS28550@tucnak.redhat.com> <878tyqsn32.fsf@kepler.schwinge.homeip.net> <3c5f38f7-ac02-6757-13bf-de48a1192048@codesourcery.com> <9b09bd96-cadc-538b-5341-6b2937ed78f5@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9b09bd96-cadc-538b-5341-6b2937ed78f5@codesourcery.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00041.txt.bz2 On Wed, Jun 01, 2016 at 09:32:26PM +0800, Chung-Lin Tang wrote: > 2016-06-01 Chung-Lin Tang > > c/ > * c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction > arguments as addressable when async clause exists. > > cp/ > * semantics.c (finish_omp_clauses): Mark OpenACC reduction > arguments as addressable when async clause exists. This LGTM. > > fortran/ > * trans-openmp.c (gfc_trans_oacc_construct): Mark OpenACC reduction > arguments as addressable. when async clause exists. > (gfc_trans_oacc_combined_directive): Likewise. > --- fortran/trans-openmp.c (revision 236845) > +++ fortran/trans-openmp.c (working copy) > @@ -2704,6 +2704,15 @@ gfc_trans_oacc_construct (gfc_code *code) > gfc_start_block (&block); > oacc_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, > code->loc); > + for (tree c = oacc_clauses; c; c = OMP_CLAUSE_CHAIN (c)) > + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC) > + { > + for (c = oacc_clauses; c; c = OMP_CLAUSE_CHAIN (c)) > + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION > + && DECL_P (OMP_CLAUSE_DECL (c))) > + TREE_ADDRESSABLE (OMP_CLAUSE_DECL (c)) = 1; > + break; > + } > stmt = gfc_trans_omp_code (code->block->next, true); > stmt = build2_loc (input_location, construct_code, void_type_node, stmt, > oacc_clauses); > @@ -3501,6 +3510,15 @@ gfc_trans_oacc_combined_directive (gfc_code *code) > construct_clauses.lists[OMP_LIST_REDUCTION] = NULL; > oacc_clauses = gfc_trans_omp_clauses (&block, &construct_clauses, > code->loc); > + for (tree c = oacc_clauses; c; c = OMP_CLAUSE_CHAIN (c)) > + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC) > + { > + for (c = oacc_clauses; c; c = OMP_CLAUSE_CHAIN (c)) > + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION > + && DECL_P (OMP_CLAUSE_DECL (c))) > + TREE_ADDRESSABLE (OMP_CLAUSE_DECL (c)) = 1; > + break; > + } > } These 2 look wrong to me. 1) you really don't need to walk all the clauses to find if there is OMP_CLAUSE_ASYNC, you can just test the async field of struct gfc_omp_clauses. And, 2) is there any reason why you can't just do this in gfc_trans_omp_clauses instead, when crating OMP_CLAUSE_REDUCTION if clauses->async is set? Or are there some cases where on OpenACC constructs you don't want to do this? Jakub