From 9bfb9d28646727d504f668522faa85c2128098a2 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Thu, 16 Nov 2023 10:37:22 +0100 Subject: [PATCH] Do not emit Profiled Parse Predicate if -XX:-UseLoopPredicate which disables Loop Predication completely --- src/hotspot/share/opto/graphKit.cpp | 7 ++++--- src/hotspot/share/opto/loopnode.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp index b271dd6f63ceb..b949244996113 100644 --- a/src/hotspot/share/opto/graphKit.cpp +++ b/src/hotspot/share/opto/graphKit.cpp @@ -4061,10 +4061,11 @@ void GraphKit::add_parse_predicate(Deoptimization::DeoptReason reason, const int void GraphKit::add_parse_predicates(int nargs) { if (UseLoopPredicate) { add_parse_predicate(Deoptimization::Reason_predicate, nargs); + if (UseProfiledLoopPredicate) { + add_parse_predicate(Deoptimization::Reason_profile_predicate, nargs); + } } - if (UseProfiledLoopPredicate) { - add_parse_predicate(Deoptimization::Reason_profile_predicate, nargs); - } + // Loop Limit Check Predicate should be near the loop. add_parse_predicate(Deoptimization::Reason_loop_limit_check, nargs); } diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 68b1f7fc54132..dd74a61d2ff73 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -1075,9 +1075,9 @@ bool PhaseIdealLoop::create_loop_nest(IdealLoopTree* loop, Node_List &old_new) { if (UseLoopPredicate) { add_parse_predicate(Deoptimization::Reason_predicate, inner_head, outer_ilt, cloned_sfpt); - } - if (UseProfiledLoopPredicate) { - add_parse_predicate(Deoptimization::Reason_profile_predicate, inner_head, outer_ilt, cloned_sfpt); + if (UseProfiledLoopPredicate) { + add_parse_predicate(Deoptimization::Reason_profile_predicate, inner_head, outer_ilt, cloned_sfpt); + } } add_parse_predicate(Deoptimization::Reason_loop_limit_check, inner_head, outer_ilt, cloned_sfpt); }