summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-structalias.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-18 10:33:11 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-18 10:33:11 +0000
commit4953672f2e14305e7abd90fadea319c02c8b4188 (patch)
tree88e29f4770593de336933a15220360a0efb6aa69 /gcc/tree-ssa-structalias.c
parent9532a31550d8cb3590ba4b6e1387831efb39face (diff)
downloadgcc-4953672f2e14305e7abd90fadea319c02c8b4188.tar.gz
2013-03-18 Richard Biener <rguenther@suse.de>
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
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r--gcc/tree-ssa-structalias.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 31a4c49c66c..31c04aa8bb3 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4196,6 +4196,29 @@ find_func_aliases_for_builtin_call (gimple t)
return true;
}
break;
+ /* String / character search functions return a pointer into the
+ source string or NULL. */
+ case BUILT_IN_INDEX:
+ case BUILT_IN_STRCHR:
+ case BUILT_IN_STRRCHR:
+ case BUILT_IN_MEMCHR:
+ case BUILT_IN_STRSTR:
+ case BUILT_IN_STRPBRK:
+ if (gimple_call_lhs (t))
+ {
+ tree src = gimple_call_arg (t, 0);
+ get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
+ constraint_expr nul;
+ nul.var = nothing_id;
+ nul.offset = 0;
+ nul.type = ADDRESSOF;
+ rhsc.safe_push (nul);
+ get_constraint_for (gimple_call_lhs (t), &lhsc);
+ process_all_all_constraints (lhsc, rhsc);
+ lhsc.release();
+ rhsc.release();
+ }
+ return true;
/* Trampolines are special - they set up passing the static
frame. */
case BUILT_IN_INIT_TRAMPOLINE: