From patchwork Wed Dec 9 10:10:44 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: 554436 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 F2393140297 for ; Wed, 9 Dec 2015 21:11:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=qGEWkU9m; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=n1k/NJjBqRv9dl7s/ eL9ZaPqCoJU4fQN4tvN4Iq/t38h5m2yy6IBWw1XcnQltnyMg5ku1zZpmJ/aaIUgI KHXFOfU9zSiRZZCfI9Qw3eyOdytFU5nhqi8wNz8K5reABqAG4eqs0TM++5AiNn1w BPxaO6HO4r5yUgmj+fGzaVRdYc= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=pWRHH1riGIychaw0k72qWEL dCM8=; b=qGEWkU9mfZh6tpSAB8qwnuUqlfeKPMp6l+Z5V7juPNSnyb4VAKMrc99 +UPjJ8NBam9s5Tx8drx50h1PT5D7SApSE+CT/5Iw7Eo2KLskfX7bOGVjuXNC8CNF nkgVcq8Rxrc52YCeRvv1fA8syqwaDwL01GyNMcu9QbGoxFsFqVk0= Received: (qmail 19555 invoked by alias); 9 Dec 2015 10:11:03 -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 19444 invoked by uid 89); 9 Dec 2015 10:11:03 -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; Wed, 09 Dec 2015 10:11:00 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55482) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1a6bi6-00024L-FU for gcc-patches@gnu.org; Wed, 09 Dec 2015 05:10:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a6bi1-00073v-3q for gcc-patches@gnu.org; Wed, 09 Dec 2015 05:10:58 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:34756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a6bi0-00073q-Ue for gcc-patches@gnu.org; Wed, 09 Dec 2015 05:10:53 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1a6bi0-0006ax-0e from Tom_deVries@mentor.com ; Wed, 09 Dec 2015 02:10:52 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Wed, 9 Dec 2015 10:10:50 +0000 Subject: Re: [PATCH, PR68716] Fix GOMP/GOACC_parallel handling in find_func_clobbers To: Jakub Jelinek References: <565C0F47.5020604@mentor.com> <565C3CEC.9040209@mentor.com> <5667FBFB.8020806@mentor.com> <20151209100358.GO5675@tucnak.redhat.com> CC: Richard Biener , "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <5667FE24.2010003@mentor.com> Date: Wed, 9 Dec 2015 11:10:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151209100358.GO5675@tucnak.redhat.com> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 09/12/15 11:03, Jakub Jelinek wrote: > On Wed, Dec 09, 2015 at 11:01:31AM +0100, Tom de Vries wrote: >> PR tree-optimization/68716 >> * tree-ssa-structalias.c (find_func_clobbers): Fix handling of >> BUILT_IN_GOMP_PARALLEL and BUILT_IN_GOMP_PARALLEL. > > Pasto in ChangeLog entry? > Indeed, thanks for noticing. - Tom Fix GOMP/GOACC_parallel handling in find_func_clobbers 2015-12-08 Tom de Vries PR tree-optimization/68716 * tree-ssa-structalias.c (find_func_clobbers): Fix handling of BUILT_IN_GOMP_PARALLEL and BUILT_IN_GOACC_PARALLEL. * testsuite/libgomp.c/omp-nested-2.c: New test. --- gcc/tree-ssa-structalias.c | 47 +++++++++++++++++++++++++++++- libgomp/testsuite/libgomp.c/omp-nested-2.c | 4 +++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 060ff3e..15e351e 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5082,7 +5082,52 @@ find_func_clobbers (struct function *fn, gimple *origt) return; case BUILT_IN_GOMP_PARALLEL: case BUILT_IN_GOACC_PARALLEL: - return; + { + unsigned int fnpos, argpos; + switch (DECL_FUNCTION_CODE (decl)) + { + case BUILT_IN_GOMP_PARALLEL: + /* __builtin_GOMP_parallel (fn, data, num_threads, flags). */ + fnpos = 0; + argpos = 1; + break; + case BUILT_IN_GOACC_PARALLEL: + /* __builtin_GOACC_parallel (device, fn, mapnum, hostaddrs, + sizes, kinds, ...). */ + fnpos = 1; + argpos = 3; + break; + default: + gcc_unreachable (); + } + + tree fnarg = gimple_call_arg (t, fnpos); + gcc_assert (TREE_CODE (fnarg) == ADDR_EXPR); + tree fndecl = TREE_OPERAND (fnarg, 0); + varinfo_t cfi = get_vi_for_tree (fndecl); + + tree arg = gimple_call_arg (t, argpos); + + /* Parameter passed by value is used. */ + lhs = get_function_part_constraint (fi, fi_uses); + struct constraint_expr *rhsp; + 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); + process_constraint (new_constraint (lhs, rhs)); + + /* The caller uses what the callee does. */ + lhs = get_function_part_constraint (fi, fi_uses); + rhs = get_function_part_constraint (cfi, fi_uses); + process_constraint (new_constraint (lhs, rhs)); + + return; + } /* printf-style functions may have hooks to set pointers to point to somewhere into the generated string. Leave them for a later exercise... */ diff --git a/libgomp/testsuite/libgomp.c/omp-nested-2.c b/libgomp/testsuite/libgomp.c/omp-nested-2.c new file mode 100644 index 0000000..7495afb --- /dev/null +++ b/libgomp/testsuite/libgomp.c/omp-nested-2.c @@ -0,0 +1,4 @@ +// { dg-do run } +// { dg-additional-options "-fipa-pta" } + +#include "omp-nested-1.c"