From 96798d120fe29acc7fb0976e084ec59aa475e283 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Mon, 26 Feb 2024 12:31:27 +0100 Subject: [PATCH] Review Emanuel --- src/hotspot/share/opto/ifnode.cpp | 13 +++++++------ .../TestBaseCountedEndLoopUnswitchCandidate.java | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hotspot/share/opto/ifnode.cpp b/src/hotspot/share/opto/ifnode.cpp index d0bd03140932c..91e1c40076e2a 100644 --- a/src/hotspot/share/opto/ifnode.cpp +++ b/src/hotspot/share/opto/ifnode.cpp @@ -455,16 +455,17 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { } IfNode* IfNode::make_with_same_profile(IfNode* if_node_profile, Node* ctrl, BoolNode* bol) { + // Assert here that we only try to create a clone from an If node with the same profiling if that actually makes sense. + // Some If node subtypes should not be cloned in this way. In theory, we should not clone BaseCountedLoopEndNodes. + // But they can end up being used as normal If nodes when peeling a loop - they serve as zero-trip guard. + // Allow them as well. + assert(if_node_profile->Opcode() == Op_If || if_node_profile->is_RangeCheck() + || if_node_profile->is_BaseCountedLoopEnd(), "should not clone other nodes"); if (if_node_profile->is_RangeCheck()) { // RangeCheck nodes could be further optimized. return new RangeCheckNode(ctrl, bol, if_node_profile->_prob, if_node_profile->_fcnt); } else { - // Not a RangeCheckNode? Fall back to IfNode. Assert here that we only try to create a clone from an If node with - // the same profiling if that actually makes sense. Some If node subtypes should not be cloned in this way. - // In theory, we should not clone BaseCountedLoopEndNodes. But they can end up being used as normal If nodes when - // peeling a loop - they serve as zero-trip guard. Allow them as well. - assert(if_node_profile->Opcode() == Op_If || if_node_profile->is_RangeCheck() - || if_node_profile->is_BaseCountedLoopEnd(), "should not clone other nodes"); + // Not a RangeCheckNode? Fall back to IfNode. return new IfNode(ctrl, bol, if_node_profile->_prob, if_node_profile->_fcnt); } } diff --git a/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java b/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java index 8899b39f230de..a115994009dac 100644 --- a/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java +++ b/test/hotspot/jtreg/compiler/loopopts/TestBaseCountedEndLoopUnswitchCandidate.java @@ -46,7 +46,6 @@ public static void main(String[] k) { } } - public static void testLongCountedLoopEnd() { long limit = lFld; for (int i = 0; i < 100; i++) {