summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-05 11:46:08 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2012-01-05 11:46:08 +0000
commitd6f0c24648ff2f75aaa61552a5266089c3032178 (patch)
treea4affa22648b7f93d8a2072095e0862c373fc03b /gcc/tree-ssa-dce.c
parent719b3a0366d1c59d33bee3525b1fa118e76eb6ab (diff)
downloadgcc-d6f0c24648ff2f75aaa61552a5266089c3032178.tar.gz
2012-01-05 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 182904 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@182905 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index a710de620df..ccdf14a1702 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1329,31 +1329,38 @@ eliminate_unnecessary_stmts (void)
}
else if (is_gimple_call (stmt))
{
- call = gimple_call_fndecl (stmt);
- if (call)
+ tree name = gimple_call_lhs (stmt);
+
+ notice_special_calls (stmt);
+
+ /* When LHS of var = call (); is dead, simplify it into
+ call (); saving one operand. */
+ if (name
+ && TREE_CODE (name) == SSA_NAME
+ && !TEST_BIT (processed, SSA_NAME_VERSION (name))
+ /* Avoid doing so for allocation calls which we
+ did not mark as necessary, it will confuse the
+ special logic we apply to malloc/free pair removal. */
+ && (!(call = gimple_call_fndecl (stmt))
+ || DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL
+ || (DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC
+ && DECL_FUNCTION_CODE (call) != BUILT_IN_CALLOC
+ && DECL_FUNCTION_CODE (call) != BUILT_IN_ALLOCA
+ && (DECL_FUNCTION_CODE (call)
+ != BUILT_IN_ALLOCA_WITH_ALIGN))))
{
- tree name;
-
- /* When LHS of var = call (); is dead, simplify it into
- call (); saving one operand. */
- name = gimple_call_lhs (stmt);
- if (name && TREE_CODE (name) == SSA_NAME
- && !TEST_BIT (processed, SSA_NAME_VERSION (name)))
+ something_changed = true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
- something_changed = true;
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Deleting LHS of call: ");
- print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
-
- gimple_call_set_lhs (stmt, NULL_TREE);
- maybe_clean_or_replace_eh_stmt (stmt, stmt);
- update_stmt (stmt);
- release_ssa_name (name);
+ fprintf (dump_file, "Deleting LHS of call: ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, "\n");
}
- notice_special_calls (stmt);
+
+ gimple_call_set_lhs (stmt, NULL_TREE);
+ maybe_clean_or_replace_eh_stmt (stmt, stmt);
+ update_stmt (stmt);
+ release_ssa_name (name);
}
}
}