+2019-01-02 Richard Biener <rguenther@suse.de>
+
+ PR ipa/85574
+ * ipa-icf.h (sem_item_optimizer::sort_congruence_split): Declare.
+ * ipa-icf.c (sem_item_optimizer::sort_congruence_split): New
+ function.
+ (sem_item_optimizer::do_congruence_step_f): Sort the congruence
+ set after UIDs before splitting them.
+
2019-01-01 Martin Sebor <msebor@redhat.com>
Jeff Law <law@redhat.com>
return true;
}
+/* Compare function for sorting pairs in do_congruence_step_f. */
+
+int
+sem_item_optimizer::sort_congruence_split (const void *a_, const void *b_)
+{
+ const std::pair<congruence_class *, bitmap> *a
+ = (const std::pair<congruence_class *, bitmap> *)a_;
+ const std::pair<congruence_class *, bitmap> *b
+ = (const std::pair<congruence_class *, bitmap> *)b_;
+ if (a->first->id < b->first->id)
+ return -1;
+ else if (a->first->id > b->first->id)
+ return 1;
+ return 0;
+}
+
/* Tests if a class CLS used as INDEXth splits any congruence classes.
Bitmap stack BMSTACK is used for bitmap allocation. */
}
}
+ auto_vec<std::pair<congruence_class *, bitmap> > to_split;
+ to_split.reserve_exact (split_map.elements ());
+ for (hash_map <congruence_class *, bitmap>::iterator i = split_map.begin ();
+ i != split_map.end (); ++i)
+ to_split.safe_push (*i);
+ to_split.qsort (sort_congruence_split);
+
traverse_split_pair pair;
pair.optimizer = this;
pair.cls = cls;
splitter_class_removed = false;
- split_map.traverse <traverse_split_pair *,
- sem_item_optimizer::traverse_congruence_split> (&pair);
+ for (unsigned i = 0; i < to_split.length (); ++i)
+ traverse_congruence_split (to_split[i].first, to_split[i].second, &pair);
/* Bitmap clean-up. */
split_map.traverse <traverse_split_pair *,
bitmap const &b,
traverse_split_pair *pair);
+ /* Compare function for sorting pairs in do_congruence_step_f. */
+ static int sort_congruence_split (const void *, const void *);
+
/* Reads a section from LTO stream file FILE_DATA. Input block for DATA
contains LEN bytes. */
void read_section (lto_file_decl_data *file_data, const char *data,