aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dce.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-07-01 12:27:33 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-07-01 12:27:33 +0000
commit14c41b9bb9c2918a0727d6dd43b96c2df0b3bcf8 (patch)
tree1817c538d837f3cc63a2849dd1c687fef88ed18d /gcc/tree-ssa-dce.c
parentf6e0880aa00a47be074e875443587a7665f68071 (diff)
downloadgcc-14c41b9bb9c2918a0727d6dd43b96c2df0b3bcf8.zip
gcc-14c41b9bb9c2918a0727d6dd43b96c2df0b3bcf8.tar.gz
gcc-14c41b9bb9c2918a0727d6dd43b96c2df0b3bcf8.tar.bz2
re PR tree-optimization/19831 (Missing DSE/malloc/free optimization)
2009-07-01 Richard Guenther <rguenther@suse.de> PR tree-optimization/19831 * tree-ssa-dce.c (propagate_necessity): Calls to functions that only act as barriers do not make any previous stores necessary. * tree-ssa-structalias.c (handle_lhs_call): Delay making HEAP variables global, do not add a constraint from nonlocal. (find_func_aliases): Handle escapes through return statements. (compute_points_to_sets): Make escaped HEAP variables global. * gcc.dg/tree-ssa/20041122-1.c: Enable TBAA, scan FRE dump, make allocated memory escape. Un-XFAIL. * gcc.dg/vect/pr21591.c: Make allocated memory escape. * gcc.dg/vect/pr31699.c: Likewise. * gcc.dg/tree-ssa/ssa-dce-7.c: New testcase. libmudflap/ * testsuite/libmudflap.c/fail11-frag.c: Make allocated memory escape. * testsuite/libmudflap.c/fail12-frag.c: Likewise. * testsuite/libmudflap.c/fail16-frag.c: Likewise. * testsuite/libmudflap.c/fail31-frag.c: Likewise. From-SVN: r149140
Diffstat (limited to 'gcc/tree-ssa-dce.c')
-rw-r--r--gcc/tree-ssa-dce.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8522c5c..6be298e 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -676,8 +676,19 @@ propagate_necessity (struct edge_list *el)
if (is_gimple_call (stmt))
{
+ tree callee = gimple_call_fndecl (stmt);
unsigned i;
+ /* Calls to functions that are merely acting as barriers
+ or that only store to memory do not make any previous
+ stores necessary. */
+ if (callee != NULL_TREE
+ && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL
+ && (DECL_FUNCTION_CODE (callee) == BUILT_IN_MEMSET
+ || DECL_FUNCTION_CODE (callee) == BUILT_IN_MALLOC
+ || DECL_FUNCTION_CODE (callee) == BUILT_IN_FREE))
+ continue;
+
/* Calls implicitly load from memory, their arguments
in addition may explicitly perform memory loads. */
mark_all_reaching_defs_necessary (stmt);