--- a/src/hotspot/share/opto/loopPredicate.cpp Mon Jul 02 13:11:41 2018 +0200
+++ b/src/hotspot/share/opto/loopPredicate.cpp Mon Jul 02 10:44:46 2018 +0200
@@ -1056,7 +1056,9 @@
stack.push(in, 1);
break;
} else if (in->is_IfProj() &&
- in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none)) {
+ in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
+ (in->in(0)->Opcode() == Op_If ||
+ in->in(0)->Opcode() == Op_RangeCheck)) {
if (pf.to(in) * loop_trip_cnt >= 1) {
stack.push(in, 1);
}
@@ -1281,7 +1283,7 @@
Node* n = skip_loop_predicates(entry);
// Check if predicates were already added to the profile predicate
// block
- if (n != entry->in(0)->in(0)) {
+ if (n != entry->in(0)->in(0) || n->outcnt() != 1) {
has_profile_predicates = true;
}
entry = n;