tree-ssa-alias.c (maybe_create_global_var): Don't just return if .GLOBAL_VAR has...
authorDiego Novillo <dnovillo@redhat.com>
Wed, 28 Jul 2004 17:57:27 +0000 (17:57 +0000)
committerDiego Novillo <dnovillo@gcc.gnu.org>
Wed, 28 Jul 2004 17:57:27 +0000 (13:57 -0400)
* tree-ssa-alias.c (maybe_create_global_var): Don't just
return if .GLOBAL_VAR has been created.

From-SVN: r85268

gcc/ChangeLog
gcc/tree-ssa-alias.c

index 259ad7c..7341996 100644 (file)
@@ -1,5 +1,10 @@
 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
        every variable that may have aliases, not just tags.
 
index 94ccd80..7ad1867 100644 (file)
@@ -1492,33 +1492,34 @@ maybe_create_global_var (struct alias_info *ai)
   size_t i, n_clobbered;
   
   /* No need to create it, if we have one already.  */
-  if (global_var)
-    return;
-
-  /* Count all the call-clobbered variables.  */
-  n_clobbered = 0;
-  EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, n_clobbered++);
+  if (global_var == NULL_TREE)
+    {
+      /* Count all the call-clobbered variables.  */
+      n_clobbered = 0;
+      EXECUTE_IF_SET_IN_BITMAP (call_clobbered_vars, 0, i, 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,
+      /* 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 ()
+               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)
-    create_global_var ();
+        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)
+       create_global_var ();
+    }
 
   /* If the function has calls to clobbering functions and .GLOBAL_VAR has
      been created, make it an alias for all call-clobbered variables.  */