The predicates are added and exists in the order given by GraphKit::add_predicate.
PhaseIdealLoop::find_predicate searches for them in a different order. This doesn't really matter, but it would be nice if this code were consistent with other code looking for these predicates.
Node* PhaseIdealLoop::find_predicate(Node* entry) {
Node* predicate = NULL;
predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check);
if (predicate != NULL) { // right pattern that can be used by loop predication
return entry;
}
if (UseLoopPredicate) {
predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
if (predicate != NULL) { // right pattern that can be used by loop predication
return entry;
}
}
if (UseProfiledLoopPredicate) {
predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_profile_predicate);
if (predicate != NULL) { // right pattern that can be used by loop predication
return entry;
}
}
return NULL;
}