diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-29 10:31:58 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-29 10:31:58 +0000 |
commit | e2486556bd37b57b5c6a839d016ceb0dcb78b0cf (patch) | |
tree | 9ac5b52b2f6b2f8b4637381bf6843792fdf1b16e /gcc/tree-ssa-alias.c | |
parent | 65085df1b5ff0ba177d505e340594f82b26d72bd (diff) | |
download | gcc-e2486556bd37b57b5c6a839d016ceb0dcb78b0cf.tar.gz |
2008-05-29 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36343
PR tree-optimization/36346
PR tree-optimization/36347
* tree-flow.h (clobber_what_p_points_to): Declare.
* tree-ssa-structalias.c (set_uids_in_ptset): Whether the
pointed-to variable is dereferenced is irrelevant to whether
the pointer can access the pointed-to variable.
(clobber_what_p_points_to): New function.
* tree-ssa-alias.c (set_initial_properties): Use it.
* tree-ssa.c (verify_flow_sensitive_alias_info): Adjust
call clobber check for NMTs.
* gcc.c-torture/execute/pr36343.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 4f661543a55..1523aebac17 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -545,8 +545,14 @@ set_initial_properties (struct alias_info *ai) { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr); tree tag = symbol_mem_tag (SSA_NAME_VAR (ptr)); - - if (pi->value_escapes_p) + + /* A pointer that only escapes via a function return does not + add to the call clobber or call used solution. + To exclude ESCAPE_TO_PURE_CONST we would need to track + call used variables separately or compute those properly + in the operand scanner. */ + if (pi->value_escapes_p + && pi->escape_mask & ~ESCAPE_TO_RETURN) { /* If PTR escapes then its associated memory tags and pointed-to variables are call-clobbered. */ @@ -556,24 +562,13 @@ set_initial_properties (struct alias_info *ai) if (tag) mark_call_clobbered (tag, pi->escape_mask); - if (pi->pt_vars) - { - bitmap_iterator bi; - unsigned int j; - EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi) - { - tree alias = referenced_var (j); - - /* If you clobber one part of a structure, you - clobber the entire thing. While this does not make - the world a particularly nice place, it is necessary - in order to allow C/C++ tricks that involve - pointer arithmetic to work. */ - if (!unmodifiable_var_p (alias)) - mark_call_clobbered (alias, pi->escape_mask); - } - } - else if (pi->pt_anything) + /* Defer to points-to analysis if possible, otherwise + clobber all addressable variables. Parameters cannot + point to local memory though. + ??? Properly tracking which pointers point to non-local + memory only would make a big difference here. */ + if (!clobber_what_p_points_to (ptr) + && !(pi->escape_mask & ESCAPE_IS_PARM)) { any_pt_anything = true; pt_anything_mask |= pi->escape_mask; |