8342975: C2: Micro-optimize PhaseIdealLoop::Dominators()

Reviewed-by: dlong, kvn
This commit is contained in:
Aleksey Shipilev 2024-10-28 15:38:05 +00:00
parent 9f6211bcf1
commit e659d9da5d

@ -410,10 +410,9 @@ void PhaseIdealLoop::Dominators() {
// Setup mappings from my Graph to Tarjan's stuff and back
// Note: Tarjan uses 1-based arrays
NTarjan *ntarjan = NEW_RESOURCE_ARRAY(NTarjan,C->unique()+1);
// Initialize _control field for fast reference
int i;
for( i= C->unique()-1; i>=0; i-- )
ntarjan[i]._control = nullptr;
// Initialize all fields at once for safety and extra performance.
// Among other things, this initializes _control field for fast reference.
memset(ntarjan, 0, (C->unique() + 1)*sizeof(NTarjan));
// Store the DFS order for the main loop
const uint fill_value = max_juint;
@ -429,6 +428,7 @@ void PhaseIdealLoop::Dominators() {
ntarjan[0]._size = ntarjan[0]._semi = 0;
ntarjan[0]._label = &ntarjan[0];
int i;
for( i = dfsnum-1; i>1; i-- ) { // For all nodes in reverse DFS order
NTarjan *w = &ntarjan[i]; // Get Node from DFS
assert(w->_control != nullptr,"bad DFS walk");