Commit e0d3bb46 by Diego Novillo Committed by Diego Novillo

tree-ssa-alias.c (maybe_create_global_var): Don't just return if .GLOBAL_VAR has been created.


	* tree-ssa-alias.c (maybe_create_global_var): Don't just
	return if .GLOBAL_VAR has been created.

From-SVN: r85268
parent 852c7b12
2004-07-28 Diego Novillo <dnovillo@redhat.com> 2004-07-28 Diego Novillo <dnovillo@redhat.com>
* tree-ssa-alias.c (maybe_create_global_var): Don't just
return if .GLOBAL_VAR has been created.
2004-07-28 Diego Novillo <dnovillo@redhat.com>
* tree-ssa.c (verify_flow_insensitive_alias_info): Process * tree-ssa.c (verify_flow_insensitive_alias_info): Process
every variable that may have aliases, not just tags. every variable that may have aliases, not just tags.
......
...@@ -1492,33 +1492,34 @@ maybe_create_global_var (struct alias_info *ai) ...@@ -1492,33 +1492,34 @@ maybe_create_global_var (struct alias_info *ai)
size_t i, n_clobbered; size_t i, n_clobbered;
/* No need to create it, if we have one already. */ /* No need to create it, if we have one already. */
if (global_var) if (global_var == NULL_TREE)
return; {
/* Count all the call-clobbered variables. */
/* Count all the call-clobbered variables. */ n_clobbered = 0;
n_clobbered = 0; EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++);
EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++);
/* Create .GLOBAL_VAR if we have too many call-clobbered variables. /* Create .GLOBAL_VAR if we have too many call-clobbered
We also create .GLOBAL_VAR when there no call-clobbered variables variables. We also create .GLOBAL_VAR when there no
to prevent code motion transformations from re-arranging function call-clobbered variables to prevent code motion
calls that may have side effects. For instance, transformations from re-arranging function calls that may
have side effects. For instance,
foo () foo ()
{ {
int a = f (); int a = f ();
g (); g ();
h (a); h (a);
} }
There are no call-clobbered variables in foo(), so it would be There are no call-clobbered variables in foo(), so it would
entirely possible for a pass to want to move the call to f() be entirely possible for a pass to want to move the call to
after the call to g(). If f() has side effects, that would be f() after the call to g(). If f() has side effects, that
wrong. Creating .GLOBAL_VAR in this case will insert VDEFs for would be wrong. Creating .GLOBAL_VAR in this case will
it and prevent such transformations. */ insert VDEFs for it and prevent such transformations. */
if (n_clobbered == 0 if (n_clobbered == 0
|| ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD) || ai->num_calls_found * n_clobbered >= (size_t) GLOBAL_VAR_THRESHOLD)
create_global_var (); create_global_var ();
}
/* If the function has calls to clobbering functions and .GLOBAL_VAR has /* If the function has calls to clobbering functions and .GLOBAL_VAR has
been created, make it an alias for all call-clobbered variables. */ been created, make it an alias for all call-clobbered variables. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment