From 14b46ba6f3e2db4acbddb979f0f8d176b476b553 Mon Sep 17 00:00:00 2001 From: Christian Hagedorn Date: Mon, 4 Mar 2024 11:03:57 +0100 Subject: [PATCH] remove useless declaration, clone_nodes -> clone_data_nodes, add assertion to prevent double-usage of clone() --- src/hotspot/share/opto/loopnode.hpp | 6 +++--- src/hotspot/share/opto/loopopts.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index 4c8c9d352f995..212d0ba438709 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -35,7 +35,6 @@ class CmpNode; class BaseCountedLoopEndNode; class CountedLoopNode; -class DataInputGraph; class IdealLoopTree; class LoopNode; class Node; @@ -1906,14 +1905,15 @@ class DataNodeGraph : public StackObj { private: void clone(Node* node, Node* new_ctrl); - void clone_nodes(Node* new_ctrl); + void clone_data_nodes(Node* new_ctrl); void rewire_clones_to_cloned_inputs(); public: // Clone the provided data node collection and rewire the clones in such a way to create an identical graph copy. // Set `new_ctrl` as ctrl for the cloned nodes. const OrigToNewHashtable& clone(Node* new_ctrl) { - clone_nodes(new_ctrl); + assert(_orig_to_new.number_of_entries() == 0, "should not call this method twice in a row"); + clone_data_nodes(new_ctrl); rewire_clones_to_cloned_inputs(); return _orig_to_new; } diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp index d4e4ac0d55ed9..76446de510c05 100644 --- a/src/hotspot/share/opto/loopopts.cpp +++ b/src/hotspot/share/opto/loopopts.cpp @@ -4496,8 +4496,7 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) { } } -// Clone all nodes in _data_nodes. -void DataNodeGraph::clone_nodes(Node* new_ctrl) { +void DataNodeGraph::clone_data_nodes(Node* new_ctrl) { for (uint i = 0; i < _data_nodes.size(); i++) { clone(_data_nodes[i], new_ctrl); }