From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122910 invoked by alias); 11 Nov 2018 17:04:26 -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 122886 invoked by uid 89); 11 Nov 2018 17:04:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=disallow X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Nov 2018 17:04:23 +0000 Received: by mail-wr1-f67.google.com with SMTP id e3-v6so6824385wrs.5; Sun, 11 Nov 2018 09:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tgeSQt1/AE8YD8iRQ1b0ulIuWfyVCAkRS6qJu8gEIds=; b=u0ZsjBZXU4ODvdz88W5pmMJLTwfFyXZeB7qtXeyrts+/EIJqEC4iFM6sT6dM7A4Cxs EPBKQgTSWWjwjlN8GL7MXP9rgfLN9+Sd3v8kNbkqYECaCt+IWouvzD0hhRQ7vXWN3674 wdV8yzvMYBL6EFYjJ0VN+i//Y0looe7aX0wjg12U1YJA+wOiGeRPgnbtugG2/C41asA1 Bm3InINhfPAqGgQNhT5eY459iLtRmOYaA8twcmr1yvoL79iKHe28npDrXVj+8cXrvRnd f0Hq7oAlOJVSqajnhz4tKr7uc2hu73Qzqx4++2guk6q6knK8keu/7w8tJkBZD9Tbe2zW +HSg== Return-Path: Received: from nbbrfq.loc (91-119-96-225.dsl.dynamic.surfer.at. [91.119.96.225]) by smtp.gmail.com with ESMTPSA id u13-v6sm9247686wrn.11.2018.11.11.09.04.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Nov 2018 09:04:20 -0800 (PST) Date: Sun, 11 Nov 2018 17:04:00 -0000 From: Bernhard Reutner-Fischer To: Julian Brown Cc: , , , , , Bernhard Reutner-Fischer Subject: Re: [PATCH 3/3] OpenACC 2.6 manual deep copy support (attach/detach) Message-ID: <20181111180412.452e5648@nbbrfq.loc> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00861.txt.bz2 On Sat, 10 Nov 2018 09:11:20 -0800 Julian Brown wrote: Two nits. > diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c > index 6430e61..ebba7ca 100644 > --- a/gcc/fortran/openmp.c > +++ b/gcc/fortran/openmp.c > @@ -3781,9 +3805,6 @@ check_array_not_assumed (gfc_symbol *sym, locus loc, const char *name) > static void > resolve_oacc_data_clauses (gfc_symbol *sym, locus loc, const char *name) > { > - if (sym->ts.type == BT_DERIVED && sym->attr.allocatable) > - gfc_error ("ALLOCATABLE object %qs of derived type in %s clause at %L", > - sym->name, name, &loc); > if ((sym->ts.type == BT_ASSUMED && sym->attr.allocatable) > || (sym->ts.type == BT_CLASS && CLASS_DATA (sym) > && CLASS_DATA (sym)->attr.allocatable)) > @@ -4153,11 +4174,23 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, > && (list != OMP_LIST_REDUCTION || !openacc)) > for (n = omp_clauses->lists[list]; n; n = n->next) > { > - if (n->sym->mark) > - gfc_error ("Symbol %qs present on multiple clauses at %L", > - n->sym->name, &n->where); > - else > - n->sym->mark = 1; > + bool array_only_p = true; > + /* Disallow duplicate bare variable references and multiple > + subarrays of the same array here, but allow multiple components of > + the same (e.g. derived-type) variable. For the latter, duplicate > + components are detected elsewhere. */ > + if (openacc && n->expr && n->expr->expr_type == EXPR_VARIABLE) > + for (gfc_ref *ref = n->expr->ref; ref; ref = ref->next) > + if (ref->type != REF_ARRAY) > + array_only_p = false; you could break here. It seems we do not perform this optimization ourself even when we could (or should) prove that the dataflow does not force the loop to run to completion?! Consider: int foo(char *str) { _Bool cond = 0; for (char *chp = str; *chp != 0; chp++) if (*chp == 42) { cond = 1; #ifdef BREAK break; #endif } return 0x0815 + cond; } $ for i in 0 1 2 3 s;do gcc -UBREAK -O$i -c -o $i.o /tmp/1/foo.c -fomit-frame-pointer -m32 -mtune=i386;done;size ?.o text data bss dec hex filename 109 0 0 109 6d 0.o 97 0 0 97 61 1.o 107 0 0 107 6b 2.o 107 0 0 107 6b 3.o 86 0 0 86 56 s.o $ for i in 0 1 2 3 s;do gcc -DBREAK -O$i -c -o $i.o /tmp/1/foo.c -fomit-frame-pointer -m32 -mtune=i386;done;size ?.o text data bss dec hex filename 111 0 0 111 6f 0.o 82 0 0 82 52 1.o 82 0 0 82 52 2.o 82 0 0 82 52 3.o 77 0 0 77 4d s.o respectively $ for i in 0 1 2 3 s;do gcc -UBREAK -O$i -c -o $i.o /tmp/1/foo.c -fomit-frame-pointer -m32 -mtune=i386 -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-guess-branch-probability;done;size ?.o text data bss dec hex filename 61 0 0 61 3d 0.o 38 0 0 38 26 1.o 43 0 0 43 2b 2.o 43 0 0 43 2b 3.o 34 0 0 34 22 s.o $ for i in 0 1 2 3 s;do gcc -DBREAK -O$i -c -o $i.o /tmp/1/foo.c -fomit-frame-pointer -m32 -mtune=i386 -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-guess-branch-probability;done;size ?.o text data bss dec hex filename 63 0 0 63 3f 0.o 39 0 0 39 27 1.o 39 0 0 39 27 2.o 39 0 0 39 27 3.o 33 0 0 33 21 s.o that's really a pity. > + if (array_only_p) > + { > + if (n->sym->mark) > + gfc_error ("Symbol %qs present on multiple clauses at %L", > + n->sym->name, &n->where); > + else > + n->sym->mark = 1; > + } > } > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index 274edc0..aa7723d 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > + /* Turning a GOMP_MAP_ALWAYS_POINTER clause into a > + GOMP_MAP_ATTACH clause after we have detected a case > + that needs a GOMP_MAP_STRUCT mapping adding. */ s/adding/added/ i think. thanks,