ipa-pure-const.c (propagate): Fix type in handling functions that can not return...
authorJan Hubicka <jh@suse.cz>
Sat, 5 Jun 2010 17:02:26 +0000 (19:02 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 5 Jun 2010 17:02:26 +0000 (17:02 +0000)
* ipa-pure-const.c (propagate): Fix type in handling functions
that can not return; be more cureful about merging the results
with previously known.

From-SVN: r160321

gcc/ChangeLog
gcc/ipa-pure-const.c

index 1f1c24a..85b61fe 100644 (file)
@@ -1,3 +1,9 @@
+2010-06-05  Jan Hubicka  <jh@suse.cz>
+
+       * ipa-pure-const.c (propagate): Fix type in handling functions
+       that can not return; be more cureful about merging the results
+       with previously known.
+
 2010-06-05  Matthias Klose  <doko@ubuntu.com>
 
        * gcc.c (cc1_options, cpp_unique_options): Use find-plugindir spec
index d785389..299019a 100644 (file)
@@ -1055,7 +1055,7 @@ propagate (void)
                               pure_const_names[y_l->pure_const_state],
                               y_l->looping);
                    }
-                 if (y_l->pure_const_state > ECF_PURE
+                 if (y_l->pure_const_state > IPA_PURE
                      && cgraph_edge_cannot_lead_to_return (e))
                    {
                      if (dump_file && (dump_flags & TDF_DETAILS))
@@ -1108,10 +1108,17 @@ propagate (void)
                      edge_looping = true;
                    }
                }
+
+             /* Merge the results with what we already know.
+                When we found function to be NEITHER, but we know
+                it is looping pure const, be sure to set the looping flag. */
              pure_const_state = MAX (pure_const_state, MIN (edge_state,
                                      w_l->state_previously_known));
-             looping = MAX (looping, MIN (edge_looping,
-                                          w_l->looping_previously_known));
+             if (edge_state > w_l->state_previously_known)
+               looping = MAX (looping, w_l->looping_previously_known);
+             else
+               looping = MAX (looping, MIN (edge_looping,
+                                            w_l->looping_previously_known));
              if (pure_const_state == IPA_NEITHER)
                break;
            }
@@ -1134,7 +1141,10 @@ propagate (void)
 
          if (w_l->state_previously_known != IPA_NEITHER
              && this_state > w_l->state_previously_known)
-            this_state = w_l->state_previously_known;
+           {
+              this_state = w_l->state_previously_known;
+             this_looping |= w_l->looping_previously_known;
+           }
          if (!this_looping && self_recursive_p (w))
            this_looping = true;
          if (!w_l->looping_previously_known)