@@ -1240,8 +1240,46 @@ void EliminateUselessPredicates::mark_useful_predicates_for_loop(IdealLoopTree*
1240
1240
void EliminateUselessPredicates::mark_maybe_useful_predicates_useless () const {
1241
1241
mark_maybe_useful_predicates_on_list_useless (_parse_predicates);
1242
1242
mark_maybe_useful_predicates_on_list_useless (_template_assertion_predicate_opaques);
1243
+ DEBUG_ONLY (verify_loop_nodes_of_useless_templates_assertion_predicates_are_dead ();)
1243
1244
}
1244
1245
1246
+ #ifdef ASSERT
1247
+ // All now useless Template Assertion Predicates should not refer to any CountedLoopNode that can still be found in the
1248
+ // graph (otherwise, they would have been marked useful instead). This is verified in this method.
1249
+ void EliminateUselessPredicates::verify_loop_nodes_of_useless_templates_assertion_predicates_are_dead () const {
1250
+ ResourceMark rm;
1251
+ Unique_Node_List loop_nodes_of_useless_template_assertion_predicates =
1252
+ collect_loop_nodes_of_useless_template_assertion_predicates ();
1253
+ verify_associated_loop_nodes_are_dead (loop_nodes_of_useless_template_assertion_predicates);
1254
+ }
1255
+
1256
+ Unique_Node_List EliminateUselessPredicates::collect_loop_nodes_of_useless_template_assertion_predicates () const {
1257
+ Unique_Node_List loop_nodes_of_useless_template_assertion_predicates;
1258
+ for (int i = 0 ; i < _template_assertion_predicate_opaques.length (); i++) {
1259
+ OpaqueTemplateAssertionPredicateNode* opaque_node = _template_assertion_predicate_opaques.at (i);
1260
+ if (opaque_node->is_useless ()) {
1261
+ loop_nodes_of_useless_template_assertion_predicates.push (opaque_node->loop_node ());
1262
+ }
1263
+ }
1264
+ return loop_nodes_of_useless_template_assertion_predicates;
1265
+ }
1266
+
1267
+ void EliminateUselessPredicates::verify_associated_loop_nodes_are_dead (
1268
+ const Unique_Node_List& loop_nodes_of_useless_template_assertion_predicates) const {
1269
+ if (loop_nodes_of_useless_template_assertion_predicates.size () == 0 ) {
1270
+ return ;
1271
+ }
1272
+ for (LoopTreeIterator iterator (_ltree_root); !iterator.done (); iterator.next ()) {
1273
+ IdealLoopTree* loop = iterator.current ();
1274
+ Node* loop_head = loop->head ();
1275
+ if (loop_head->is_CountedLoop ()) {
1276
+ assert (!loop_nodes_of_useless_template_assertion_predicates.member (loop_head),
1277
+ " CountedLoopNode should be dead when found in OpaqueTemplateAssertionPredicateNode being marked useless" );
1278
+ }
1279
+ }
1280
+ }
1281
+ #endif // ASSERT
1282
+
1245
1283
template <class PredicateList >
1246
1284
void EliminateUselessPredicates::mark_maybe_useful_predicates_on_list_useless (
1247
1285
const PredicateList& predicate_list) const {
0 commit comments