From: Tom de Vries <Tom_deVries@mentor.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>,
Richard Biener <rguenther@suse.de>
Subject: [gomp4,committed] Remove release_dangling_ssa_names
Date: Wed, 30 Sep 2015 08:05:00 -0000 [thread overview]
Message-ID: <560B7E60.2040806@mentor.com> (raw)
In-Reply-To: <87fv24fav1.fsf@schwinge.name>
[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]
[ was: Re: [PATCH] Don't create superfluous parm in expand_omp_taskreg ]
On 24/09/15 11:02, Thomas Schwinge wrote:
> Hi Tom!
>
> On Thu, 24 Sep 2015 08:36:27 +0200, Tom de Vries<Tom_deVries@mentor.com> wrote:
>> >On 24/09/15 08:23, Thomas Schwinge wrote:
>>> > >On Tue, 11 Aug 2015 20:53:39 +0200, Tom de Vries<Tom_deVries@mentor.com> wrote:
>>>> > >>Don't create superfluous parm in expand_omp_taskreg
>>>> > >>
>>>> > >>2015-08-11 Tom de Vries<tom@codesourcery.com>
>>>> > >>
>>>> > >> * omp-low.c (expand_omp_taskreg): If in ssa, set rhs of parcopy stmt to
>>>> > >> parm_decl, rather than generating a dummy default def in cfun.
>>>> > >> * tree-cfg.c (replace_ssa_name): Assume no default defs. Make sure
>>>> > >> ssa_name from cfun and child_fn do not share a stmt as def stmt.
>>>> > >> (move_stmt_op): Handle PARM_DECl.
>>>> > >> (gather_ssa_name_hash_map_from): New function.
>>>> > >> (move_sese_region_to_fn): Add default defs for function params, and add
>>>> > >> them to vars_map. Release copied ssa names.
>>>> > >> * tree-cfg.h (gather_ssa_name_hash_map_from): Declare.
>>> > >
>>> > >Do I understand correct that with this change present on trunk (which I'm
>>> > >currently merging into gomp-4_0-branch), the changes you've earlier done
>>> > >on gomp-4_0-branch to gcc/omp-low.c:release_dangling_ssa_names,
>>> > >gcc/tree-cfg.c:replace_ssa_name, should now be reverted? That is, how
>>> > >much of the following patches can be reverted now (listed backwards in
>>> > >time)?
>> >
>> >indeed, in the above commit we release the dangling ssa names in
>> >move_sese_region_to_fn. So after committing this patch to the
>> >gomp-4_0-branch, the call to release_dangling_ssa_names is no longer
>> >necessary, and the function release_dangling_ssa_names can be removed.
<SNIP>
> <tschwinge> Well, I'm asking because in my merge tree, I'm running
> into an assertion that you added there -- not sure yet whether I've
> done something wrong, though.
The source of the problem was in expand_omp_target, which needed similar
changes as expand_omp_taskreg got in the "Don't create superfluous parm
in expand_omp_taskreg" patch.
Now that the merge (
https://gcc.gnu.org/viewcvs/gcc/branches/gomp-4_0-branch/gcc/omp-low.c?limit_changes=0&r1=228091&r2=228090&pathrev=228091
) contains that change, I've committed these two patches to gomp-4_0-branch:
- Revert "Fix release_dangling_ssa_names"
(Reverting an earlier attempt to handle the
release_dangling_ssa_names TODO, which was committed to the
gomp-4_0-branch)
- Remove release_dangling_ssa_names
Thanks,
- Tom
[-- Attachment #2: 0001-Revert-Fix-release_dangling_ssa_names.patch --]
[-- Type: text/x-patch, Size: 3457 bytes --]
Revert "Fix release_dangling_ssa_names"
2015-09-24 Tom de Vries <tom@codesourcery.com>
Revert:
2015-08-05 Tom de Vries <tom@codesourcery.com>
* omp-low.c (release_dangling_ssa_names): Release SSA_NAMEs with NULL
def stmt.
* tree-cfg.c (replace_ssa_name): Don't move default def nops. Set def
stmt of unused SSA_NAME to NULL.
---
gcc/omp-low.c | 33 ++++++++++++++++++++++++---------
gcc/tree-cfg.c | 12 ------------
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index a72db53..04a60ab 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10541,10 +10541,11 @@ make_pass_expand_omp (gcc::context *ctxt)
return new pass_expand_omp (ctxt);
}
-/* After running pass_expand_omp_ssa to expand the oacc kernels directive, we
- are left in the original function with anonymous SSA_NAMEs, with a NULL
- defining statement. This function finds those SSA_NAMEs and releases
- them. */
+/* After running pass_expand_omp_ssa to expand the oacc kernels
+ directive, we are left in the original function with anonymous
+ SSA_NAMEs, with a defining statement that has been deleted. This
+ pass finds those SSA_NAMEs and releases them.
+ TODO: Either fix this elsewhere, or make the fix unnecessary. */
static void
release_dangling_ssa_names (void)
@@ -10559,12 +10560,26 @@ release_dangling_ssa_names (void)
gimple *stmt = SSA_NAME_DEF_STMT (name);
if (stmt != NULL)
continue;
+ bool found = false;
- release_ssa_name (name);
- gcc_assert (SSA_NAME_IN_FREE_LIST (name));
- if (dump_file
- && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "Released dangling ssa name %u\n", i);
+ ssa_op_iter op_iter;
+ def_operand_p def_p;
+ FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_ALL_DEFS)
+ {
+ tree def = DEF_FROM_PTR (def_p);
+ if (def == name)
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Released dangling ssa name %u\n", i);
+ release_ssa_name (name);
+ }
}
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index cd7a4b4..a3c3b20 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -6422,12 +6422,6 @@ replace_ssa_name (tree name, hash_map<tree, tree> *vars_map,
{
gcc_assert (!SSA_NAME_IS_DEFAULT_DEF (name));
replace_by_duplicate_decl (&decl, vars_map, to_context);
- /* If name is a default def, then we don't move the defining stmt
- (which is a nop). Because (1) the nop doesn't belong to the sese
- region, and (2) while setting the def stmt of name to NULL would
- trigger release_ssa_name in release_dangling_ssa_names, it wouldn't
- be released since it's a default def, and subsequently cause an
- ssa verification failure. */
new_name = make_ssa_name_fn (DECL_STRUCT_FUNCTION (to_context),
decl, SSA_NAME_DEF_STMT (name));
if (SSA_NAME_IS_DEFAULT_DEF (name))
@@ -6443,12 +6437,6 @@ replace_ssa_name (tree name, hash_map<tree, tree> *vars_map,
SSA_NAME_DEF_STMT (name) = NULL;
vars_map->put (name, new_name);
-
- if (!SSA_NAME_IS_DEFAULT_DEF (name))
- /* The statement has been moved to the child function. It no longer
- defines name in the original function. Mark the def stmt NULL, and
- let release_dangling_ssa_names deal with it. */
- SSA_NAME_DEF_STMT (name) = NULL;
}
else
new_name = *loc;
--
1.9.1
[-- Attachment #3: 0002-Remove-release_dangling_ssa_names.patch --]
[-- Type: text/x-patch, Size: 1966 bytes --]
Remove release_dangling_ssa_names
2015-09-24 Tom de Vries <tom@codesourcery.com>
* omp-low.c (release_dangling_ssa_names): Remove.
(pass_omp_expand_ssa::execute): Remove call to
release_dangling_ssa_names.
---
gcc/omp-low.c | 46 +---------------------------------------------
1 file changed, 1 insertion(+), 45 deletions(-)
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 04a60ab..6bdfaa2 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10541,48 +10541,6 @@ make_pass_expand_omp (gcc::context *ctxt)
return new pass_expand_omp (ctxt);
}
-/* After running pass_expand_omp_ssa to expand the oacc kernels
- directive, we are left in the original function with anonymous
- SSA_NAMEs, with a defining statement that has been deleted. This
- pass finds those SSA_NAMEs and releases them.
- TODO: Either fix this elsewhere, or make the fix unnecessary. */
-
-static void
-release_dangling_ssa_names (void)
-{
- unsigned int i;
- for (i = 1; i < num_ssa_names; ++i)
- {
- tree name = ssa_name (i);
- if (name == NULL_TREE)
- continue;
-
- gimple *stmt = SSA_NAME_DEF_STMT (name);
- if (stmt != NULL)
- continue;
- bool found = false;
-
- ssa_op_iter op_iter;
- def_operand_p def_p;
- FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_ALL_DEFS)
- {
- tree def = DEF_FROM_PTR (def_p);
- if (def == name)
- {
- found = true;
- break;
- }
- }
-
- if (!found)
- {
- if (dump_file)
- fprintf (dump_file, "Released dangling ssa name %u\n", i);
- release_ssa_name (name);
- }
- }
-}
-
namespace {
const pass_data pass_data_expand_omp_ssa =
@@ -10613,9 +10571,7 @@ public:
}
virtual unsigned int execute (function *)
{
- unsigned res = execute_expand_omp ();
- release_dangling_ssa_names ();
- return res;
+ return execute_expand_omp ();
}
opt_pass * clone () { return new pass_expand_omp_ssa (m_ctxt); }
--
1.9.1
next prev parent reply other threads:[~2015-09-30 6:17 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 14:08 openacc kernels directive -- initial support Tom de Vries
2014-11-15 17:21 ` [PATCH, 1/8] Expand oacc kernels after pass_build_ealias Tom de Vries
2014-11-24 11:29 ` Tom de Vries
2014-11-25 11:30 ` Tom de Vries
2015-04-21 19:40 ` Expand oacc kernels after pass_fre (was: [PATCH, 1/8] Expand oacc kernels after pass_build_ealias) Thomas Schwinge
2015-04-22 7:36 ` Richard Biener
2015-06-04 16:50 ` Expand oacc kernels after pass_fre Tom de Vries
2015-06-08 7:29 ` Richard Biener
2015-06-19 9:04 ` Tom de Vries
2015-08-05 7:24 ` [committed, gomp4] Fix release_dangling_ssa_names Tom de Vries
2015-08-05 7:29 ` Richard Biener
2015-08-05 8:48 ` Tom de Vries
2015-08-05 9:30 ` Richard Biener
2015-08-05 10:49 ` Tom de Vries
2015-08-05 11:13 ` Richard Biener
2015-08-11 9:25 ` [committed] Add todo comment for move_sese_region_to_fn Tom de Vries
2015-08-11 18:53 ` [PATCH] Don't create superfluous parm in expand_omp_taskreg Tom de Vries
2015-08-12 10:51 ` Richard Biener
2015-09-24 6:36 ` Thomas Schwinge
2015-09-24 7:21 ` Tom de Vries
2015-09-24 9:31 ` Thomas Schwinge
2015-09-30 8:05 ` Tom de Vries [this message]
2015-09-30 10:05 ` [gomp4,committed] Remove release_dangling_ssa_names Thomas Schwinge
2015-09-30 10:25 ` Tom de Vries
2015-09-30 10:43 ` Thomas Schwinge
2014-11-15 17:22 ` [PATCH, 2/8] Add pass_oacc_kernels Tom de Vries
2014-11-25 11:31 ` Tom de Vries
2015-04-21 19:46 ` Thomas Schwinge
2014-11-15 17:23 ` [PATCH, 4/8] Add pass_tree_loop_{init,done} to pass_oacc_kernels Tom de Vries
2014-11-25 11:42 ` Tom de Vries
2015-04-21 19:52 ` Thomas Schwinge
2015-04-22 7:40 ` Richard Biener
2015-06-02 13:52 ` Tom de Vries
2015-06-02 13:58 ` Richard Biener
2015-06-02 15:40 ` Tom de Vries
2015-06-03 11:26 ` Richard Biener
2014-11-15 17:23 ` [PATCH, 3/8] Add pass_ch_oacc_kernels " Tom de Vries
2014-11-25 11:39 ` Tom de Vries
2015-04-21 19:49 ` Thomas Schwinge
2015-04-22 7:39 ` Richard Biener
2015-06-03 9:22 ` Tom de Vries
2015-06-03 11:21 ` Richard Biener
2015-06-04 15:59 ` Tom de Vries
2015-06-03 10:05 ` Tom de Vries
2015-06-03 11:22 ` Richard Biener
2014-11-15 17:24 ` [PATCH, 5/8] Add pass_loop_im " Tom de Vries
2014-11-25 12:00 ` Tom de Vries
2015-04-21 19:57 ` [PATCH, 5/8] Add pass_lim " Thomas Schwinge
2014-11-15 18:32 ` [PATCH, 6/8] Add pass_ccp " Tom de Vries
2014-11-25 12:03 ` Tom de Vries
2015-04-21 20:01 ` [PATCH, 6/8] Add pass_copy_prop in pass_oacc_kernels Thomas Schwinge
2015-04-22 7:42 ` Richard Biener
2015-06-02 13:04 ` Tom de Vries
2014-11-15 18:52 ` [PATCH, 7/8] Add pass_parloops_oacc_kernels to pass_oacc_kernels Tom de Vries
2014-11-25 12:15 ` Tom de Vries
2015-04-21 20:09 ` [PATCH, 7/8] Add pass_parallelize_loops_oacc_kernels " Thomas Schwinge
2014-11-15 19:04 ` [PATCH, 8/8] Do simple omp lowering for no address taken var Tom de Vries
2014-11-17 10:29 ` Richard Biener
2014-11-18 9:13 ` Eric Botcazou
2014-11-18 9:53 ` Richard Biener
2014-11-18 12:20 ` Richard Biener
2014-11-24 11:53 ` Tom de Vries
2014-11-24 11:55 ` Tom de Vries
2014-11-24 12:42 ` Richard Biener
2014-11-24 18:49 ` Tom de Vries
2014-11-24 12:40 ` Richard Biener
2014-11-19 20:34 ` openacc kernels directive -- initial support Tom de Vries
2015-04-21 19:27 ` Add BUILT_IN_GOACC_KERNELS_INTERNAL (was: openacc kernels directive -- initial support) Thomas Schwinge
2015-04-21 20:24 ` Handle global loop counters in fortran oacc kernels " Thomas Schwinge
2015-04-21 20:29 ` Handle global loop counters in c/c++ " Thomas Schwinge
2015-04-21 20:33 ` Handle oacc kernels with other directives " Thomas Schwinge
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560B7E60.2040806@mentor.com \
--to=tom_devries@mentor.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=rguenther@suse.de \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).