aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2005-01-27 04:45:20 +0000
committerDiego Novillo <dnovillo@gcc.gnu.org>2005-01-26 23:45:20 -0500
commit87637d21c0eab59ae9ba4ca7b3593fe847cc1bed (patch)
tree839beaf956bc6b73ae54db4610def572b171b9e0 /gcc/tree-ssa-alias.c
parent9ff93eb01ce59be5d7b26428df5e5bf6671bce86 (diff)
downloadgcc-87637d21c0eab59ae9ba4ca7b3593fe847cc1bed.zip
gcc-87637d21c0eab59ae9ba4ca7b3593fe847cc1bed.tar.gz
gcc-87637d21c0eab59ae9ba4ca7b3593fe847cc1bed.tar.bz2
re PR tree-optimization/19633 (local address incorrectly thought to escape)
PR tree-optimization/19633 * tree-ssa-alias.c (ptr_is_dereferenced_by): Also handle CALL_EXPRs. (maybe_create_global_var): Do not create .GLOBAL_VAR if there are no call-clobbered variables. * tree-outof-ssa.c (check_replaceable): Return false for calls with side-effects. testsuite/ChangeLog PR tree-optimization/19633 * gcc.dg/pr19633.c: New test. * gcc.dg/tree-ssa/pr19633.c: New test. From-SVN: r94311
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index a410217..da11fd0 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -621,6 +621,16 @@ ptr_is_dereferenced_by (tree ptr, tree stmt, bool *is_store)
return true;
}
}
+ else
+ {
+ /* CALL_EXPRs may also contain pointer dereferences for types
+ that are not GIMPLE register types. If the CALL_EXPR is on
+ the RHS of an assignment, it will be handled by the
+ MODIFY_EXPR handler above. */
+ tree call = get_call_expr_in (stmt);
+ if (call && walk_tree (&call, find_ptr_dereference, ptr, NULL))
+ return true;
+ }
return false;
}
@@ -1538,26 +1548,7 @@ maybe_create_global_var (struct alias_info *ai)
n_clobbered++;
}
- /* Create .GLOBAL_VAR if we have too many call-clobbered
- variables. We also create .GLOBAL_VAR when there no
- call-clobbered variables to prevent code motion
- transformations from re-arranging function calls that may
- have side effects. For instance,
-
- foo ()
- {
- int a = f ();
- g ();
- h (a);
- }
-
- There are no call-clobbered variables in foo(), so it would
- be entirely possible for a pass to want to move the call to
- f() after the call to g(). If f() has side effects, that
- would be wrong. Creating .GLOBAL_VAR in this case will
- insert VDEFs for it and prevent such transformations. */
- if (n_clobbered == 0
- || ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD)
+ if (ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD)
create_global_var ();
}