summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-19 12:13:04 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-19 12:13:04 +0000
commit9e074a9876994946014369d39b49c52c07b46811 (patch)
tree221ac9b3dfe9da860699b5550f4d105eeac0c368
parent003000a47d821aaebff9e7ed6e28c5fc15ca2d88 (diff)
downloadgcc-9e074a9876994946014369d39b49c52c07b46811.tar.gz
2016-04-19 Richard Biener <rguenther@suse.de>
* gimple-walk.h (struct walk_stmt_info): Add stmt member. * gimple-walk.c (walk_gimple_op): Initialize it. (walk_gimple_asm): Set wi->is_lhs before each callback invocation. * tree-inline.c (remap_gimple_op_r): Set SSA_NAME_DEF_STMT when remapping SSA names of defs. (copy_bb): Remove walk over all SSA defs and SSA_NAME_DEF_STMT adjustment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235190 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/gimple-walk.c8
-rw-r--r--gcc/gimple-walk.h1
-rw-r--r--gcc/tree-inline.c16
4 files changed, 22 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 458f2cd338d..39bbca2e1c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2016-04-19 Richard Biener <rguenther@suse.de>
+
+ * gimple-walk.h (struct walk_stmt_info): Add stmt member.
+ * gimple-walk.c (walk_gimple_op): Initialize it.
+ (walk_gimple_asm): Set wi->is_lhs before each callback invocation.
+ * tree-inline.c (remap_gimple_op_r): Set SSA_NAME_DEF_STMT when
+ remapping SSA names of defs.
+ (copy_bb): Remove walk over all SSA defs and SSA_NAME_DEF_STMT
+ adjustment.
+
2016-04-18 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/70689
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 15cd8420904..be501c5cecb 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -100,9 +100,6 @@ walk_gimple_asm (gasm *stmt, walk_tree_fn callback_op,
noutputs = gimple_asm_noutputs (stmt);
oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *));
- if (wi)
- wi->is_lhs = true;
-
for (i = 0; i < noutputs; i++)
{
op = gimple_asm_output_op (stmt, i);
@@ -114,6 +111,8 @@ walk_gimple_asm (gasm *stmt, walk_tree_fn callback_op,
&allows_reg, &is_inout))
wi->val_only = (allows_reg || !allows_mem);
}
+ if (wi)
+ wi->is_lhs = true;
ret = walk_tree (&TREE_VALUE (op), callback_op, wi, NULL);
if (ret)
return ret;
@@ -182,6 +181,9 @@ walk_gimple_op (gimple *stmt, walk_tree_fn callback_op,
unsigned i;
tree ret = NULL_TREE;
+ if (wi)
+ wi->stmt = stmt;
+
switch (gimple_code (stmt))
{
case GIMPLE_ASSIGN:
diff --git a/gcc/gimple-walk.h b/gcc/gimple-walk.h
index d5d1a824c6e..3ef868a647f 100644
--- a/gcc/gimple-walk.h
+++ b/gcc/gimple-walk.h
@@ -28,6 +28,7 @@ struct walk_stmt_info
{
/* Points to the current statement being walked. */
gimple_stmt_iterator gsi;
+ gimple *stmt;
/* Additional data that the callback functions may want to carry
through the recursion. */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index a4e044c611b..015a9074b78 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -863,10 +863,16 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
copy_body_data *id = (copy_body_data *) wi_p->info;
tree fn = id->src_fn;
+ /* For recursive invocations this is no longer the LHS itself. */
+ bool is_lhs = wi_p->is_lhs;
+ wi_p->is_lhs = false;
+
if (TREE_CODE (*tp) == SSA_NAME)
{
*tp = remap_ssa_name (*tp, id);
*walk_subtrees = 0;
+ if (is_lhs)
+ SSA_NAME_DEF_STMT (*tp) = wi_p->stmt;
return NULL;
}
else if (auto_var_in_fn_p (*tp, fn))
@@ -2095,16 +2101,6 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
maybe_duplicate_eh_stmt_fn (cfun, stmt, id->src_cfun, orig_stmt,
id->eh_map, id->eh_lp_nr);
- if (gimple_in_ssa_p (cfun) && !is_gimple_debug (stmt))
- {
- ssa_op_iter i;
- tree def;
-
- FOR_EACH_SSA_TREE_OPERAND (def, stmt, i, SSA_OP_DEF)
- if (TREE_CODE (def) == SSA_NAME)
- SSA_NAME_DEF_STMT (def) = stmt;
- }
-
gsi_next (&copy_gsi);
}
while (!gsi_end_p (copy_gsi));