This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix gimple-fold
- From: Martin Liška <mliska at suse dot cz>
- To: Jakub Jelinek <jakub at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 18 Mar 2014 14:29:30 +0100
- Subject: Re: [PATCH] Fix gimple-fold
- Authentication-results: sourceware.org; auth=none
- References: <53283E3B dot 4050700 at suse dot cz> <CAFiYyc3TBe-zHcOaMooZQNxN6j9L+pDuxHq_=KpyAoUnYG1THg at mail dot gmail dot com> <20140318131316 dot GU22862 at tucnak dot redhat dot com>
Thank you for feedback,
new changelog:
2014-03-18 Martin Liska <mliska@suse.cz>
* cgraph.c (cgraph_update_edges_for_call_stmt_node): Added case
when
gimple call statement is update.
* gimple-fold.c (gimple_fold_call): Changed order for
GIMPLE_ASSIGN and
GIMPLE_CALL, where gsi iterator still points to GIMPLE CALL.
OK for trunk?
Martin
On 03/18/2014 02:13 PM, Jakub Jelinek wrote:
Hi!
2014-03-18 Martin Liska <mliska@suse.cz>
* cgraph.c (cgraph_update_edges_for_call_stmt_node): added case when
gimple call statement is updated.
Capital letter after :
* gimple-fold.c (gimple_fold_call): changed order for GIMPLE_ASSIGN and
Likewise here.
Jakub
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index a15b6bc..269146a 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1519,7 +1519,10 @@ cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
{
if (callee->decl == new_call
|| callee->former_clone_of == new_call)
- return;
+ {
+ cgraph_set_call_stmt (e, new_stmt);
+ return;
+ }
callee = callee->clone_of;
}
}
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index eafdb2d..177abc1 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1153,8 +1153,13 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
{
tree var = create_tmp_var (TREE_TYPE (lhs), NULL);
tree def = get_or_create_ssa_default_def (cfun, var);
- gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
+
+ /* To satisfy condition for
+ cgraph_update_edges_for_call_stmt_node,
+ we need to preserve GIMPLE_CALL statement
+ at position of GSI iterator. */
update_call_from_tree (gsi, def);
+ gsi_insert_before (gsi, new_stmt, GSI_NEW_STMT);
}
else
gsi_replace (gsi, new_stmt, true);