aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-06-22 10:46:36 +0000
committerJakub Jelinek <jakub@redhat.com>2011-06-22 10:46:36 +0000
commit798961fdcc395fe3a08de3db973c419c31829fcc (patch)
tree5db992248a216e242d2e9eff0ad5aea9a9f3ebdd /gcc/tree-ssa-alias.c
parent5378b08e2ab31704c8b36ad435da4e8d6d47303e (diff)
* tree-ssa-ccp.c (evaluate_stmt): Try bitwise tracking for
builtin calls even if likelyvalue is not CONSTANT. Handle BUILT_IN_STRDUP and BUILT_IN_STRNDUP like BUILT_IN_MALLOC. Return get_value_for_expr of first operand for BUILT_IN_{MEM{CPY,MOVE,SET},STR{,N}CPY}{,_CHK}. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle BUILT_IN_{MEM{{,P}CPY,MOVE,SET},STR{,N}C{PY,AT},STPCPY}_CHK like their non-checking counterparts. (call_may_clobber_ref_p_1): Likewise. (stmt_kills_ref_p_1): Handle BUILT_IN_MEM{{,P}CPY,MOVE,SET}_CHK like their non-checking counterparts. * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Handle BUILT_IN_{MEM{{,P}CPY,MOVE,SET},STR{,N}C{PY,AT},STPCPY}_CHK like their non-checking counterparts. (find_func_clobbers): Likewise. * tree-ssa-dce.c (propagate_necessity): Handle BUILT_IN_MEMSET_CHK like BUILT_IN_MEMSET and BUILT_IN_CALLOC like BUILT_IN_MALLOC. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@175290 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 02b3ca07e07..5647899f531 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1,5 +1,5 @@
/* Alias analysis for trees.
- Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
@@ -1199,6 +1199,24 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
size);
return refs_may_alias_p_1 (&dref, ref, false);
}
+ case BUILT_IN_STRCPY_CHK:
+ case BUILT_IN_STRNCPY_CHK:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMPCPY_CHK:
+ case BUILT_IN_STPCPY_CHK:
+ case BUILT_IN_STRCAT_CHK:
+ case BUILT_IN_STRNCAT_CHK:
+ {
+ ao_ref dref;
+ tree size = NULL_TREE;
+ if (gimple_call_num_args (call) == 4)
+ size = gimple_call_arg (call, 2);
+ ao_ref_init_from_ptr_and_size (&dref,
+ gimple_call_arg (call, 1),
+ size);
+ return refs_may_alias_p_1 (&dref, ref, false);
+ }
case BUILT_IN_BCOPY:
{
ao_ref dref;
@@ -1216,6 +1234,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
case BUILT_IN_STACK_SAVE:
case BUILT_IN_STACK_RESTORE:
case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMSET_CHK:
case BUILT_IN_FREXP:
case BUILT_IN_FREXPF:
case BUILT_IN_FREXPL:
@@ -1453,6 +1472,25 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
size);
return refs_may_alias_p_1 (&dref, ref, false);
}
+ case BUILT_IN_STRCPY_CHK:
+ case BUILT_IN_STRNCPY_CHK:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMPCPY_CHK:
+ case BUILT_IN_STPCPY_CHK:
+ case BUILT_IN_STRCAT_CHK:
+ case BUILT_IN_STRNCAT_CHK:
+ case BUILT_IN_MEMSET_CHK:
+ {
+ ao_ref dref;
+ tree size = NULL_TREE;
+ if (gimple_call_num_args (call) == 4)
+ size = gimple_call_arg (call, 2);
+ ao_ref_init_from_ptr_and_size (&dref,
+ gimple_call_arg (call, 0),
+ size);
+ return refs_may_alias_p_1 (&dref, ref, false);
+ }
case BUILT_IN_BCOPY:
{
ao_ref dref;
@@ -1697,6 +1735,10 @@ stmt_kills_ref_p_1 (gimple stmt, ao_ref *ref)
case BUILT_IN_MEMPCPY:
case BUILT_IN_MEMMOVE:
case BUILT_IN_MEMSET:
+ case BUILT_IN_MEMCPY_CHK:
+ case BUILT_IN_MEMPCPY_CHK:
+ case BUILT_IN_MEMMOVE_CHK:
+ case BUILT_IN_MEMSET_CHK:
{
tree dest = gimple_call_arg (stmt, 0);
tree len = gimple_call_arg (stmt, 2);