diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-03-28 16:30:58 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-03-28 15:30:58 +0000 |
commit | 23a042164f370ccdf0bc0f5d4d755bbaf0ae1f75 (patch) | |
tree | 4e759e52926d15fec39ff3ed739eafa05de86636 /gcc | |
parent | a4971e68935654be575c76864b954a80c94d6c42 (diff) | |
download | gcc-23a042164f370ccdf0bc0f5d4d755bbaf0ae1f75.zip gcc-23a042164f370ccdf0bc0f5d4d755bbaf0ae1f75.tar.gz gcc-23a042164f370ccdf0bc0f5d4d755bbaf0ae1f75.tar.bz2 |
cgraph.c: Include expr.h and tree-dfa.h.
* cgraph.c: Include expr.h and tree-dfa.h.
(cgraph_redirect_edge_call_stmt_to_callee): If call in noreturn; remove LHS.
From-SVN: r208901
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cgraph.c | 19 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c619f8e..1ca072e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-03-28 Jan Hubicka <hubicka@ucw.cz> + + * cgraph.c: Include expr.h and tree-dfa.h. + (cgraph_redirect_edge_call_stmt_to_callee): If call in noreturn; remove LHS. + 2014-03-28 Vladimir Makarov <vmakarov@redhat.com> PR target/60675 diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 586ef79..3b76aa4 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -61,6 +61,8 @@ along with GCC; see the file COPYING3. If not see #include "ipa-inline.h" #include "cfgloop.h" #include "gimple-pretty-print.h" +#include "expr.h" +#include "tree-dfa.h" /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */ #include "tree-pass.h" @@ -1329,6 +1331,7 @@ gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) { tree decl = gimple_call_fndecl (e->call_stmt); + tree lhs = gimple_call_lhs (e->call_stmt); gimple new_stmt; gimple_stmt_iterator gsi; #ifdef ENABLE_CHECKING @@ -1471,6 +1474,22 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e) update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stmt); } + /* If the call becomes noreturn, remove the lhs. */ + if (lhs && (gimple_call_flags (new_stmt) & ECF_NORETURN)) + { + if (TREE_CODE (lhs) == SSA_NAME) + { + gsi = gsi_for_stmt (new_stmt); + + tree var = create_tmp_var (TREE_TYPE (lhs), NULL); + tree def = get_or_create_ssa_default_def + (DECL_STRUCT_FUNCTION (e->caller->decl), var); + gimple set_stmt = gimple_build_assign (lhs, def); + gsi_insert_before (&gsi, set_stmt, GSI_SAME_STMT); + } + gimple_call_set_lhs (new_stmt, NULL_TREE); + } + cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt, false); if (cgraph_dump_file) |