Commit 29cbd18b by Eric Botcazou Committed by Eric Botcazou

tree-inline.c (copy_edges_for_bb): Minor tweak.

	* tree-inline.c (copy_edges_for_bb): Minor tweak.
	(maybe_move_debug_stmts_to_successors): Also reset the locus of the
	debug statement when resetting its value.
	(expand_call_inline): Copy the locus of the call onto the assignment
	of the return value, if any.  Use local variable in more cases.

From-SVN: r261853
parent e9df6a8f
2018-06-21 Eric Botcazou <ebotcazou@adacore.com>
* tree-inline.c (copy_edges_for_bb): Minor tweak.
(maybe_move_debug_stmts_to_successors): Also reset the locus of the
debug statement when resetting its value.
(expand_call_inline): Copy the locus of the call onto the assignment
of the return value, if any. Use local variable in more cases.
2018-06-21 Martin Liska <mliska@suse.cz> 2018-06-21 Martin Liska <mliska@suse.cz>
* ipa-pure-const.c (propagate_nothrow): Use * ipa-pure-const.c (propagate_nothrow): Use
......
...@@ -2151,7 +2151,6 @@ copy_edges_for_bb (basic_block bb, profile_count num, profile_count den, ...@@ -2151,7 +2151,6 @@ copy_edges_for_bb (basic_block bb, profile_count num, profile_count den,
edge_iterator ei; edge_iterator ei;
edge old_edge; edge old_edge;
gimple_stmt_iterator si; gimple_stmt_iterator si;
int flags;
bool need_debug_cleanup = false; bool need_debug_cleanup = false;
/* Use the indices from the original blocks to create edges for the /* Use the indices from the original blocks to create edges for the
...@@ -2160,14 +2159,14 @@ copy_edges_for_bb (basic_block bb, profile_count num, profile_count den, ...@@ -2160,14 +2159,14 @@ copy_edges_for_bb (basic_block bb, profile_count num, profile_count den,
if (!(old_edge->flags & EDGE_EH)) if (!(old_edge->flags & EDGE_EH))
{ {
edge new_edge; edge new_edge;
int flags = old_edge->flags;
flags = old_edge->flags; /* Return edges do get a FALLTHRU flag when they get inlined. */
/* Return edges do get a FALLTHRU flag when the get inlined. */
if (old_edge->dest->index == EXIT_BLOCK if (old_edge->dest->index == EXIT_BLOCK
&& !(old_edge->flags & (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE|EDGE_FAKE)) && !(flags & (EDGE_TRUE_VALUE|EDGE_FALSE_VALUE|EDGE_FAKE))
&& old_edge->dest->aux != EXIT_BLOCK_PTR_FOR_FN (cfun)) && old_edge->dest->aux != EXIT_BLOCK_PTR_FOR_FN (cfun))
flags |= EDGE_FALLTHRU; flags |= EDGE_FALLTHRU;
new_edge = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags); new_edge = make_edge (new_bb, (basic_block) old_edge->dest->aux, flags);
new_edge->probability = old_edge->probability; new_edge->probability = old_edge->probability;
} }
...@@ -2502,7 +2501,10 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb) ...@@ -2502,7 +2501,10 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
si = ssi; si = ssi;
gsi_prev (&ssi); gsi_prev (&ssi);
if (!single_pred_p (e->dest) && gimple_debug_bind_p (stmt)) if (!single_pred_p (e->dest) && gimple_debug_bind_p (stmt))
gimple_debug_bind_reset_value (stmt); {
gimple_debug_bind_reset_value (stmt);
gimple_set_location (stmt, UNKNOWN_LOCATION);
}
gsi_remove (&si, false); gsi_remove (&si, false);
gsi_insert_before (&dsi, stmt, GSI_SAME_STMT); gsi_insert_before (&dsi, stmt, GSI_SAME_STMT);
continue; continue;
...@@ -2515,10 +2517,10 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb) ...@@ -2515,10 +2517,10 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
{ {
value = gimple_debug_bind_get_value (stmt); value = gimple_debug_bind_get_value (stmt);
value = unshare_expr (value); value = unshare_expr (value);
new_stmt = gimple_build_debug_bind (var, value, stmt);
} }
else else
value = NULL_TREE; new_stmt = gimple_build_debug_bind (var, NULL_TREE, NULL);
new_stmt = gimple_build_debug_bind (var, value, stmt);
} }
else if (gimple_debug_source_bind_p (stmt)) else if (gimple_debug_source_bind_p (stmt))
{ {
...@@ -4456,9 +4458,9 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) ...@@ -4456,9 +4458,9 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
id->assign_stmts.create (0); id->assign_stmts.create (0);
/* Update the callers EH personality. */ /* Update the callers EH personality. */
if (DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl)) if (DECL_FUNCTION_PERSONALITY (fn))
DECL_FUNCTION_PERSONALITY (cg_edge->caller->decl) DECL_FUNCTION_PERSONALITY (cg_edge->caller->decl)
= DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl); = DECL_FUNCTION_PERSONALITY (fn);
/* Split the block before the GIMPLE_CALL. */ /* Split the block before the GIMPLE_CALL. */
stmt_gsi = gsi_for_stmt (stmt); stmt_gsi = gsi_for_stmt (stmt);
...@@ -4711,6 +4713,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) ...@@ -4711,6 +4713,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
{ {
gimple *old_stmt = stmt; gimple *old_stmt = stmt;
stmt = gimple_build_assign (gimple_call_lhs (stmt), use_retvar); stmt = gimple_build_assign (gimple_call_lhs (stmt), use_retvar);
gimple_set_location (stmt, gimple_location (old_stmt));
gsi_replace (&stmt_gsi, stmt, false); gsi_replace (&stmt_gsi, stmt, false);
maybe_clean_or_replace_eh_stmt (old_stmt, stmt); maybe_clean_or_replace_eh_stmt (old_stmt, stmt);
/* Append a clobber for id->retvar if easily possible. */ /* Append a clobber for id->retvar if easily possible. */
...@@ -4806,7 +4809,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id) ...@@ -4806,7 +4809,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
variables in the function when the blocks get blown away as soon as we variables in the function when the blocks get blown away as soon as we
remove the cgraph node. */ remove the cgraph node. */
if (gimple_block (stmt)) if (gimple_block (stmt))
(*debug_hooks->outlining_inline_function) (cg_edge->callee->decl); (*debug_hooks->outlining_inline_function) (fn);
/* Update callgraph if needed. */ /* Update callgraph if needed. */
cg_edge->callee->remove (); cg_edge->callee->remove ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment