From 8f252203d8d1bd6d5db396b42deb22b855809dfb Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 21 Apr 2015 10:23:25 +0000 Subject: [PATCH] df-core.c (df_finish_pass): Iterate over df->problems_by_index[] and use df_remove_problem rather than... 2015-04-21 Thomas Preud'homme * 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 | 6 ++++++ gcc/df-core.c | 19 ++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64e9aae187b..73ede9eada0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-04-21 Thomas Preud'homme + + * 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 PR tree-optimization/65802 diff --git a/gcc/df-core.c b/gcc/df-core.c index 82f136436bb..67040a10d39 100644 --- a/gcc/df-core.c +++ b/gcc/df-core.c @@ -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; -- 2.30.2