From patchwork Fri Dec 11 12:24:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 555742 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 2AB721402D9 for ; Fri, 11 Dec 2015 23:24:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=jHclq2Uf; 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:from :to:cc:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=bQf9e8CzSUr12V3HoTHmQMdSt0Wao6Dq2Em2xw6HLFz/XZcUCM n3+D3UCV1e6POhOW2wq2PHpZYe3CnuqCJoRMyMgbF/OeQZ3jJhCi77scmLT9rP8l 6IhcJY9w4X86hnYhCnNUKNPsme9YZ3v6pCMwU25rwwxLRMAuidEAcpbnk= 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:cc:subject:message-id:date:mime-version:content-type; s= default; bh=WT0qEpYcbwF5TrASP5Ckeifi8VY=; b=jHclq2UfBAg3Q/Ch0p0i Yg76vkviES/7C3HLTYwhexUk+oX3CQI/uBdUeVjnXNhOEJ1lo/o00IrsCNPpfvIk 5J0LhGHOTgGkaUF4FAL2ENDO96KemxPHEBJ9bqHMpx9aa7irfavzlRXIgYfeuQt6 Q5rhE626BzyoFFlZQqZ4EpM= Received: (qmail 109230 invoked by alias); 11 Dec 2015 12:24:47 -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 109218 invoked by uid 89); 11 Dec 2015 12:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 11 Dec 2015 12:24:45 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33130) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1a7Mkc-00068T-HG for gcc-patches@gnu.org; Fri, 11 Dec 2015 07:24:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a7MkZ-0005U0-2I for gcc-patches@gnu.org; Fri, 11 Dec 2015 07:24:42 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:62364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a7MkY-0005Tw-SQ for gcc-patches@gnu.org; Fri, 11 Dec 2015 07:24:38 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1a7MkX-0000k1-40 from Tom_deVries@mentor.com ; Fri, 11 Dec 2015 04:24:37 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Fri, 11 Dec 2015 12:24:35 +0000 From: Tom de Vries To: Richard Biener CC: "gcc-patches@gnu.org" Subject: [PATCH] Handle sizes and kinds params of GOACC_paralllel in find_func_clobbers Message-ID: <566AC080.8080500@mentor.com> Date: Fri, 11 Dec 2015 13:24:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 Hi, while testing the oacc kernels patch series on top of trunk, using the optimal handling of BUILTIN_IN_GOACC_PARALLEL in fipa-pta I ran into a failure where the stores to the omp_data_sizes array were removed by dse. The call bb in the failing testcase normally looks like this: ... : .omp_data_arr.10.D.2550 = c.2_18; .omp_data_arr.10.c = &c; .omp_data_arr.10.D.2553 = b.1_15; .omp_data_arr.10.b = &b; .omp_data_arr.10.D.2556 = a.0_11; .omp_data_arr.10.a = &a; D.2572 = n_6(D); .omp_data_arr.10.n = &D.2572; .omp_data_sizes.11[0] = _8; .omp_data_sizes.11[1] = 0; .omp_data_sizes.11[2] = _8; .omp_data_sizes.11[3] = 0; .omp_data_sizes.11[4] = _8; .omp_data_sizes.11[5] = 0; .omp_data_sizes.11[6] = 4; __builtin_GOACC_parallel_keyed (-1, foo._omp_fn.0, 7, &.omp_data_arr.10, &.omp_data_sizes.11, &.omp_data_kinds.12, 0); ... Dse removed the stores, because omp_data_sizes was not marked as a used by __builtin_GOACC_parallel_keyed. We pretend in fipa-pta that __builtin_GOACC_parallel_keyed is never called, and instead handle the call foo._omp_fn.0 (&.omp_data_arr.10). That means the use of omp_data_sizes by __builtin_GOACC_parallel_keyed is ignored. This patch fixes that (for both sizes and kinds arrays), as confirmed with a test run of target-libgomp c.exp on the accelerator. OK for stage3 if bootstrap and reg-test succeeds? Thanks, - Tom Handle sizes and kinds params of GOACC_paralllel in find_func_clobbers 2015-12-11 Tom de Vries * tree-ssa-structalias.c (find_func_clobbers): Handle sizes and kinds parameters of GOACC_paralllel. --- gcc/tree-ssa-structalias.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index dfc0422..98d7d7b 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5089,6 +5089,8 @@ find_func_clobbers (struct function *fn, gimple *origt) case BUILT_IN_GOACC_PARALLEL: { unsigned int fnpos, argpos; + unsigned int implicit_use_args[2]; + unsigned int num_implicit_use_args = 0; switch (DECL_FUNCTION_CODE (decl)) { case BUILT_IN_GOMP_PARALLEL: @@ -5101,6 +5103,8 @@ find_func_clobbers (struct function *fn, gimple *origt) sizes, kinds, ...). */ fnpos = 1; argpos = 3; + implicit_use_args[num_implicit_use_args++] = 4; + implicit_use_args[num_implicit_use_args++] = 5; break; default: gcc_unreachable (); @@ -5121,6 +5125,18 @@ find_func_clobbers (struct function *fn, gimple *origt) process_constraint (new_constraint (lhs, *rhsp)); rhsc.truncate (0); + /* Handle parameters used by the call, but not used in cfi, as + implicitly used by cfi. */ + lhs = get_function_part_constraint (cfi, fi_uses); + for (unsigned i = 0; i < num_implicit_use_args; ++i) + { + tree arg = gimple_call_arg (t, implicit_use_args[i]); + get_constraint_for (arg, &rhsc); + FOR_EACH_VEC_ELT (rhsc, j, rhsp) + process_constraint (new_constraint (lhs, *rhsp)); + rhsc.truncate (0); + } + /* The caller clobbers what the callee does. */ lhs = get_function_part_constraint (fi, fi_clobbers); rhs = get_function_part_constraint (cfi, fi_clobbers);