From bd31fe14d2dfb4b12a82d9a223853ff2228a6523 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 3 Mar 2015 10:21:56 +0100 Subject: [PATCH] re PR ipa/65087 (r220742 causes: ICE: in ipcp_verify_propagated_values, at ipa-cp.c:1057) Fix PR ipa/65087. PR ipa/65087 * ipa-icf.c (sem_item_optimizer::execute): Change function return value to boolean. (sem_item_optimizer::merge_classes): Likewise. (ipa_icf_driver): Return TODO_remove_functions in case there's a merge operation processed. * ipa-icf.h: Change function return value to boolean. Co-Authored-By: Martin Jambor From-SVN: r221133 --- gcc/ChangeLog | 11 +++++++++++ gcc/ipa-icf.c | 26 ++++++++++++++++++-------- gcc/ipa-icf.h | 11 +++++++---- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64d86ccdbc6..7d8cf784e9b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-03-03 Martin Liska + Martin Jambor + + PR ipa/65087 + * ipa-icf.c (sem_item_optimizer::execute): Change function + return value to boolean. + (sem_item_optimizer::merge_classes): Likewise. + (ipa_icf_driver): Return TODO_remove_functions in case there's + a merge operation processed. + * ipa-icf.h: Change function return value to boolean. + 2015-03-02 Michael Meissner PR 65138/target diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 31fcbec6615..9cdd73eb9d2 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -2167,9 +2167,11 @@ sem_item_optimizer::filter_removed_items (void) m_items.safe_push (filtered[i]); } -/* Optimizer entry point. */ +/* Optimizer entry point which returns true in case it processes + a merge operation. True is returned if there's a merge operation + processed. */ -void +bool sem_item_optimizer::execute (void) { filter_removed_items (); @@ -2214,10 +2216,12 @@ sem_item_optimizer::execute (void) process_cong_reduction (); dump_cong_classes (); verify_classes (); - merge_classes (prev_class_count); + bool merged_p = merge_classes (prev_class_count); if (dump_file && (dump_flags & TDF_DETAILS)) symtab_node::dump_table (dump_file); + + return merged_p; } /* Function responsible for visiting all potential functions and @@ -2870,9 +2874,10 @@ sem_item_optimizer::dump_cong_classes (void) /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes - before reduction. */ + before reduction. True is returned if there's a merge operation + processed. */ -void +bool sem_item_optimizer::merge_classes (unsigned int prev_class_count) { unsigned int item_count = m_items.length (); @@ -2882,6 +2887,8 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count) unsigned int non_singular_classes_count = 0; unsigned int non_singular_classes_sum = 0; + bool merged_p = false; + for (hash_table::iterator it = m_classes.begin (); it != m_classes.end (); ++it) for (unsigned int i = 0; i < (*it)->classes.length (); i++) @@ -2952,9 +2959,12 @@ sem_item_optimizer::merge_classes (unsigned int prev_class_count) alias->dump_to_file (dump_file); } - source->merge (alias); + if (source->merge (alias)) + merged_p = true; } } + + return merged_p; } /* Dump function prints all class members to a FILE with an INDENT. */ @@ -3031,12 +3041,12 @@ ipa_icf_driver (void) { gcc_assert (optimizer); - optimizer->execute (); + bool merged_p = optimizer->execute (); delete optimizer; optimizer = NULL; - return 0; + return merged_p ? TODO_remove_functions : 0; } const pass_data pass_data_ipa_icf = diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index e3582db89a8..14813533888 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -470,8 +470,10 @@ public: read-only variables that can be merged. */ void parse_funcs_and_vars (void); - /* Optimizer entry point. */ - void execute (void); + /* Optimizer entry point which returns true in case it processes + a merge operation. True is returned if there's a merge operation + processed. */ + bool execute (void); /* Dump function. */ void dump (void); @@ -545,8 +547,9 @@ private: /* After reduction is done, we can declare all items in a group to be equal. PREV_CLASS_COUNT is start number of classes - before reduction. */ - void merge_classes (unsigned int prev_class_count); + before reduction. True is returned if there's a merge operation + processed. */ + bool merge_classes (unsigned int prev_class_count); /* Adds a newly created congruence class CLS to worklist. */ void worklist_push (congruence_class *cls); -- 2.30.2