From 4953672f2e14305e7abd90fadea319c02c8b4188 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 18 Mar 2013 10:33:11 +0000 Subject: 2013-03-18 Richard Biener PR tree-optimization/56210 * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Handle string / character search functions. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196777 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 2df27dda3c7..878d8407185 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1314,6 +1314,43 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + /* These read memory pointed to by the first argument. */ + case BUILT_IN_INDEX: + case BUILT_IN_STRCHR: + case BUILT_IN_STRRCHR: + { + ao_ref dref; + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + NULL_TREE); + return refs_may_alias_p_1 (&dref, ref, false); + } + /* These read memory pointed to by the first argument with size + in the third argument. */ + case BUILT_IN_MEMCHR: + { + ao_ref dref; + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + gimple_call_arg (call, 2)); + return refs_may_alias_p_1 (&dref, ref, false); + } + /* These read memory pointed to by the first and second arguments. */ + case BUILT_IN_STRSTR: + case BUILT_IN_STRPBRK: + { + ao_ref dref; + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + NULL_TREE); + if (refs_may_alias_p_1 (&dref, ref, false)) + return true; + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 1), + NULL_TREE); + return refs_may_alias_p_1 (&dref, ref, false); + } + /* The following builtins do not read from memory. */ case BUILT_IN_FREE: case BUILT_IN_MALLOC: -- cgit v1.2.1