From patchwork Thu Nov 5 11:25:46 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: 540359 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 48B5A140311 for ; Thu, 5 Nov 2015 22:26:21 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WBQBrLHn; 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=ZHrOKECP3UXb6Kh31 9WolCPa1CbUHQ6uxw7+tjrOPBs4r/Bl+s/4BcpErtfgNeb45n5+FYJWvD6SLOrUq UDhk6UWcXPs6/5rDeUi4MxKLO3EqbkC7Rvy+Q8UICL8MAg0wruCiT+DFgRSmW1bG IkTNc0xHc7hXveJPEwMb4dON5g= 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=/zJbczzWdmOqNDE6eWVwTNy uYZw=; b=WBQBrLHn3rTRf4Wy+PsF+F08uLVYsZsEb/GPYUd29VaOTV6/hMdWhcr 5eU57An2/4igPuei2ADn/lt10fYZr19Xv1Ad0tTzqyRjy/iWBiQXelMZ1g4wecdC X4zV6crrARcsePIxwgAg3+6gSvy7iUGHZUe9CzHVpMzXRV1d6N34= Received: (qmail 91756 invoked by alias); 5 Nov 2015 11:26:14 -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 91745 invoked by uid 89); 5 Nov 2015 11:26:13 -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; Thu, 05 Nov 2015 11:26:11 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56539) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ZuIgD-0002uQ-I7 for gcc-patches@gnu.org; Thu, 05 Nov 2015 06:26:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuIg9-0002xb-UQ for gcc-patches@gnu.org; Thu, 05 Nov 2015 06:26:09 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:44548) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuIg9-0002xN-Ok for gcc-patches@gnu.org; Thu, 05 Nov 2015 06:26:05 -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 1ZuIg7-0004dD-Sb from Tom_deVries@mentor.com ; Thu, 05 Nov 2015 03:26:04 -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; Thu, 5 Nov 2015 11:26:02 +0000 Subject: [gomp4, committed, 8/9] Release_defs in expand_omp_atomic_fetch_op To: "gcc-patches@gnu.org" References: <563B2C99.90308@mentor.com> CC: Jakub Jelinek From: Tom de Vries Message-ID: <563B3CBA.1080605@mentor.com> Date: Thu, 5 Nov 2015 12:25:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <563B2C99.90308@mentor.com> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 05/11/15 11:16, Tom de Vries wrote: > Hi, > > now that we have committed -foffload-alias in gomp-4_0-branch ( > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg00214.html ), we no longer > need the kernels region to be a part of the original function when doing > alias analysis. > > So, we no longer have the need to postpone splitting off the kernels > region into a seperate function until after alias analysis, but we can > do this at the same time as when we expand the parallel region. > > The following patch series implements that: > > 1 Move expansion of kernels region back to first omp-expand > 2 Update gate_oacc_kernels to handle oacc function > 3 Revert "Add skip_stmt parm to pass_dominator::get_sese ()" > 4 Revert "Add pass_dominator::sese_mode_p ()" > 5 Handle oacc function in parloops > 6 Update goacc kernels C testcases > 7 Update goacc kernels Fortran testcases > 8 Release_defs in expand_omp_atomic_fetch_op > 9 Remove BUILT_IN_GOACC_KERNELS_INTERNAL > > [ The patch series is broken up into logical bits, but intended as > single commit. Various things in kernels support will be broken in > intermediate stages. ] > > Committed to gomp-4_0-branch. > > I'll post the patches in reply to this message. > The parloops pass constructs an atomic update: ... #pragma omp atomic_load D.1839_59 = *&.paral_data_load.33_51->reduction.23; D.1840_60 = sum.27_56 + D.1839_59; #pragma omp atomic_store (D.1840_60); ... The expand_omp_atomic_fetch_op function removes the update statement but doesn't release the ssa-name D.1840_60 defined by the update statement. This causes an error when running ccp in lto1. We run into trouble here for this unreleased ssa-name, because SSA_NAME_VAR (var) == NULL_TREE and TREE_CODE (NULL_TREE) causes a sigsegv: ... get_default_value (tree var) { ccp_prop_value_t val = { UNINITIALIZED, NULL_TREE, 0 }; gimple *stmt; stmt = SSA_NAME_DEF_STMT (var); if (gimple_nop_p (stmt)) { /* Variables defined by an empty statement are those used before being initialized. If VAR is a local variable, we can assume initially that it is UNDEFINED, otherwise we must consider it VARYING. */ if (!virtual_operand_p (var) && TREE_CODE (SSA_NAME_VAR (var)) == VAR_DECL) val.lattice_val = UNDEFINED; ... This patch fixes the problem by releasing the ssa-name in expand_omp_atomic_fetch_op function. Thanks, - Tom Release_defs in expand_omp_atomic_fetch_op 2015-11-04 Tom de Vries * omp-low.c (expand_omp_atomic_fetch_op): Release defs of update stmt. --- gcc/omp-low.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 58cb959..84accd9 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -11914,10 +11914,14 @@ expand_omp_atomic_fetch_op (basic_block load_bb, gcc_assert (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ATOMIC_STORE); gsi_remove (&gsi, true); gsi = gsi_last_bb (store_bb); + stmt = gsi_stmt (gsi); gsi_remove (&gsi, true); if (gimple_in_ssa_p (cfun)) - update_ssa (TODO_update_ssa_no_phi); + { + release_defs (stmt); + update_ssa (TODO_update_ssa_no_phi); + } return true; } -- 1.9.1