From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101499 invoked by alias); 29 May 2015 16:23:46 -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 101488 invoked by uid 89); 29 May 2015 16:23:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_ASCII_DIVIDERS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no 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 (AES256-SHA encrypted) ESMTPS; Fri, 29 May 2015 16:23:44 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54368) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1YyN4P-0000co-OZ for gcc-patches@gnu.org; Fri, 29 May 2015 12:23:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyN4L-0006TJ-SX for gcc-patches@gnu.org; Fri, 29 May 2015 12:23:41 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:49175) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyN4L-0006Sp-JO for gcc-patches@gnu.org; Fri, 29 May 2015 12:23:37 -0400 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 1YyN4J-0002eR-4D from Bernd_Schmidt@mentor.com ; Fri, 29 May 2015 09:23:35 -0700 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; Fri, 29 May 2015 17:23:33 +0100 Message-ID: <55689279.2020809@codesourcery.com> Date: Fri, 29 May 2015 17:12:00 -0000 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: CC: Jakub Jelinek Subject: [gomp4] Avoiding predication for certain blocks Content-Type: multipart/mixed; boundary="------------030607070900060304000002" X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 X-SW-Source: 2015-05/txt/msg02803.txt.bz2 --------------030607070900060304000002 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 414 When predicating the code for OpenACC, we should avoid the entry block in an offloaded region, which contains setup code that should be run in every thread. The following patch adds a new marker statement that is used to identify this block. Currently, predication doesn't happen anyway due to an oversight in the algorithm, but I'll be fixing that in a followup patch. Committed on gomp-4_0-branch. Bernd --------------030607070900060304000002 Content-Type: text/x-patch; name="omp-entry.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="omp-entry.diff" Content-length: 5707 Index: gcc/ChangeLog.gomp =================================================================== --- gcc/ChangeLog.gomp (revision 223867) +++ gcc/ChangeLog.gomp (working copy) @@ -1,3 +1,18 @@ +2015-05-29 Bernd Schmidt + + * gimple.def (GIMPLE_OMP_ENTRY_END): New code. + * gimple.h (gimple_build_omp_entry_end): Declare. + (CASE_GIMPLE_OMP): Add GIMPLE_OMP_ENTRY_END. + * gimple.c (gimple_build_omp_entry_end): New function. + * gimple-low.c (lower_stmt): Handle GIMPLE_OMP_ENTRY_END. + * omp-low.c (expand_omp_target): Remove the entry end statement. + (predicate_bb): Don't predicate a block ending with + GIMPLE_OMP_ENTRY_END. + (lower_omp_target): Append a GIMPLE_OMP_ENTRY_END after the + ganglocal data allocation. + (make_gimple_omp_edges): Handle GIMPLE_OMP_ENTRY_END. + * gimple-pretty-print.c (pp_gimple_stmt_1): Likewise. + 2015-05-28 Tom de Vries * passes.def: Replace pass_copy_prop with pass_fre. Surround with Index: gcc/gimple-low.c =================================================================== --- gcc/gimple-low.c (revision 223867) +++ gcc/gimple-low.c (working copy) @@ -337,6 +337,7 @@ lower_stmt (gimple_stmt_iterator *gsi, s case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: case GIMPLE_OMP_CONTINUE: + case GIMPLE_OMP_ENTRY_END: break; case GIMPLE_CALL: Index: gcc/gimple-pretty-print.c =================================================================== --- gcc/gimple-pretty-print.c (revision 223867) +++ gcc/gimple-pretty-print.c (working copy) @@ -2253,6 +2253,10 @@ pp_gimple_stmt_1 (pretty_printer *buffer pp_string (buffer, "GIMPLE_SECTIONS_SWITCH"); break; + case GIMPLE_OMP_ENTRY_END: + pp_string (buffer, "GIMPLE_OMP_ENTRY_END"); + break; + case GIMPLE_OMP_MASTER: case GIMPLE_OMP_TASKGROUP: case GIMPLE_OMP_ORDERED: Index: gcc/gimple.c =================================================================== --- gcc/gimple.c (revision 223867) +++ gcc/gimple.c (working copy) @@ -852,6 +852,15 @@ gimple_build_debug_source_bind_stat (tre } +/* Build a GIMPLE_OMP_ENTRY_END statement. */ + +gimple +gimple_build_omp_entry_end (void) +{ + return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0); +} + + /* Build a GIMPLE_OMP_CRITICAL statement. BODY is the sequence of statements for which only one thread can execute. Index: gcc/gimple.def =================================================================== --- gcc/gimple.def (revision 223867) +++ gcc/gimple.def (working copy) @@ -227,6 +227,10 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimp iteration in partially lowered OpenMP code. */ DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", GSS_OMP_CONTINUE) +/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block + into an offloaded region. */ +DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE) + /* GIMPLE_OMP_CRITICAL represents #pragma omp critical [name] Index: gcc/gimple.h =================================================================== --- gcc/gimple.h (revision 223867) +++ gcc/gimple.h (working copy) @@ -1351,6 +1351,7 @@ gimple gimple_build_omp_taskgroup (gimpl gomp_continue *gimple_build_omp_continue (tree, tree); gimple gimple_build_omp_ordered (gimple_seq); gimple gimple_build_omp_return (bool); +gimple gimple_build_omp_entry_end (); gomp_sections *gimple_build_omp_sections (gimple_seq, tree); gimple gimple_build_omp_sections_switch (void); gomp_single *gimple_build_omp_single (gimple_seq, tree); @@ -5597,6 +5598,7 @@ gimple_return_set_retbnd (gimple gs, tre case GIMPLE_OMP_ORDERED: \ case GIMPLE_OMP_CRITICAL: \ case GIMPLE_OMP_RETURN: \ + case GIMPLE_OMP_ENTRY_END: \ case GIMPLE_OMP_ATOMIC_LOAD: \ case GIMPLE_OMP_ATOMIC_STORE: \ case GIMPLE_OMP_CONTINUE Index: gcc/omp-low.c =================================================================== --- gcc/omp-low.c (revision 223867) +++ gcc/omp-low.c (working copy) @@ -9480,6 +9480,11 @@ expand_omp_target (struct omp_region *re } } + basic_block entry_succ_bb = single_succ (entry_bb); + gsi = gsi_last_bb (entry_succ_bb); + if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END) + gsi_remove (&gsi, true); + if (offloaded && do_splitoff) { @@ -9501,7 +9506,6 @@ expand_omp_target (struct omp_region *re tree data_arg = gimple_omp_target_data_arg (entry_stmt); if (data_arg) { - basic_block entry_succ_bb = single_succ (entry_bb); gimple_stmt_iterator gsi; tree arg, narg; gimple tgtcopy_stmt = NULL; @@ -10131,6 +10135,8 @@ build_omp_regions_1 (basic_block bb, str gcc_assert (parent); parent->cont = bb; } + else if (code == GIMPLE_OMP_ENTRY_END) + gcc_assert (parent); else if (code == GIMPLE_OMP_SECTIONS_SWITCH) { /* GIMPLE_OMP_SECTIONS_SWITCH is part of @@ -10308,6 +10314,9 @@ predicate_bb (basic_block bb, struct omp basic_block skip_dest_bb = NULL; basic_block *adjust_bb_ptr = NULL; + if (gimple_code (stmt) == GIMPLE_OMP_ENTRY_END) + return; + if (gimple_code (stmt) == GIMPLE_COND) { tree cond_var = create_tmp_var (boolean_type_node); @@ -12705,6 +12714,7 @@ lower_omp_target (gimple_stmt_iterator * if (offloaded) { + gimple_seq_add_stmt (&new_body, gimple_build_omp_entry_end ()); if (has_reduction) { gimple_seq_add_seq (&irlist, tgt_body); @@ -13442,6 +13452,7 @@ make_gimple_omp_edges (basic_block bb, s fallthru = false; break; + case GIMPLE_OMP_ENTRY_END: case GIMPLE_OMP_ATOMIC_LOAD: case GIMPLE_OMP_ATOMIC_STORE: fallthru = true; --------------030607070900060304000002--