-
Enhancement
-
Resolution: Unresolved
-
P5
-
17, 19, 20, 21, 22
There could be cases, where we add a Loop Limit Check Predicate with insert_loop_limit_check_predicate() but later, we bail out of is_counted_loop(). For example, by setting -XX:StressLongCountedLoop or when having a safepoint on the backedge (https://github.com/openjdk/jdk/blob/087887286d575107c076605e1027b553939c3836/src/hotspot/share/opto/loopnode.cpp#L1901-L1911, triggered by attached test).
We could end up adding multiple Loop Limit Check Predicates for a single loop and/or having a Loop Limit Check Predicate for a LoopNode (non-counted) which could lead to unnecessary deoptimizations/re-compilations.
Even though this is an edge case, we should probably fix that.
To run TestLoopLimitCheckNonCountedLoop.java, we require the following new IR Node:
diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
index def34bb4ac6..1475f5d6677 100644
--- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
+++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
@@ -619,6 +619,11 @@ public class IRNode {
fromBeforeCountedLoops(LOOP, regex);
}
+ public static final String LOOP_LIMIT_CHECK_TRAP = PREFIX + "LOOP_LIMIT_CHECK_TRAP" + POSTFIX;
+ static {
+ trapNodes(LOOP_LIMIT_CHECK_TRAP, "loop_limit_check");
+ }
+
public static final String LSHIFT = PREFIX + "LSHIFT" + POSTFIX;
static {
beforeMatchingNameRegex(LSHIFT, "LShift(I|L)");
We could end up adding multiple Loop Limit Check Predicates for a single loop and/or having a Loop Limit Check Predicate for a LoopNode (non-counted) which could lead to unnecessary deoptimizations/re-compilations.
Even though this is an edge case, we should probably fix that.
To run TestLoopLimitCheckNonCountedLoop.java, we require the following new IR Node:
diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
index def34bb4ac6..1475f5d6677 100644
--- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
+++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java
@@ -619,6 +619,11 @@ public class IRNode {
fromBeforeCountedLoops(LOOP, regex);
}
+ public static final String LOOP_LIMIT_CHECK_TRAP = PREFIX + "LOOP_LIMIT_CHECK_TRAP" + POSTFIX;
+ static {
+ trapNodes(LOOP_LIMIT_CHECK_TRAP, "loop_limit_check");
+ }
+
public static final String LSHIFT = PREFIX + "LSHIFT" + POSTFIX;
static {
beforeMatchingNameRegex(LSHIFT, "LShift(I|L)");