df-core.c (df_finish_pass): Iterate over df->problems_by_index[] and use df_remove_pr...
authorThomas Preud'homme <thomas.preudhomme@arm.com>
Tue, 21 Apr 2015 10:23:25 +0000 (10:23 +0000)
committerThomas Preud'homme <thopre01@gcc.gnu.org>
Tue, 21 Apr 2015 10:23:25 +0000 (10:23 +0000)
2015-04-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    * df-core.c (df_finish_pass): Iterate over df->problems_by_index[] and
    use df_remove_problem rather than manually removing problems, leaving
    holes in df->problems_in_order[].

From-SVN: r222260

gcc/ChangeLog
gcc/df-core.c

index 64e9aae187b558f7749e4fe64e8d17b3d58a6063..73ede9eada0b098bc894d2194fb470b52407280e 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-21  Thomas Preud'homme  <thomas.preudhomme@arm.com>
+
+       * df-core.c (df_finish_pass): Iterate over df->problems_by_index[] and
+       use df_remove_problem rather than manually removing problems, leaving
+       holes in df->problems_in_order[].
+
 2015-04-21  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/65802
index 82f136436bbca80fbdeef30b601871a9cedb99a5..67040a10d3983ce3dc73f1f06e99d2a10f18ee73 100644 (file)
@@ -642,7 +642,6 @@ void
 df_finish_pass (bool verify ATTRIBUTE_UNUSED)
 {
   int i;
-  int removed = 0;
 
 #ifdef ENABLE_DF_CHECKING
   int saved_flags;
@@ -658,21 +657,15 @@ df_finish_pass (bool verify ATTRIBUTE_UNUSED)
   saved_flags = df->changeable_flags;
 #endif
 
-  for (i = 0; i < df->num_problems_defined; i++)
+  /* We iterate over problems by index as each problem removed will
+     lead to problems_in_order to be reordered.  */
+  for (i = 0; i < DF_LAST_PROBLEM_PLUS1; i++)
     {
-      struct dataflow *dflow = df->problems_in_order[i];
-      struct df_problem *problem = dflow->problem;
+      struct dataflow *dflow = df->problems_by_index[i];
 
-      if (dflow->optional_p)
-       {
-         gcc_assert (problem->remove_problem_fun);
-         (problem->remove_problem_fun) ();
-         df->problems_in_order[i] = NULL;
-         df->problems_by_index[problem->id] = NULL;
-         removed++;
-       }
+      if (dflow && dflow->optional_p)
+       df_remove_problem (dflow);
     }
-  df->num_problems_defined -= removed;
 
   /* Clear all of the flags.  */
   df->changeable_flags = 0;