File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -410,10 +410,9 @@ void PhaseIdealLoop::Dominators() {
410410 // Setup mappings from my Graph to Tarjan's stuff and back
411411 // Note: Tarjan uses 1-based arrays
412412 NTarjan *ntarjan = NEW_RESOURCE_ARRAY (NTarjan,C->unique ()+1 );
413- // Initialize _control field for fast reference
414- int i;
415- for ( i= C->unique ()-1 ; i>=0 ; i-- )
416- ntarjan[i]._control = nullptr ;
413+ // Initialize all fields at once for safety and extra performance.
414+ // Among other things, this initializes _control field for fast reference.
415+ memset (ntarjan, 0 , (C->unique () + 1 )*sizeof (NTarjan));
417416
418417 // Store the DFS order for the main loop
419418 const uint fill_value = max_juint;
@@ -429,6 +428,7 @@ void PhaseIdealLoop::Dominators() {
429428 ntarjan[0 ]._size = ntarjan[0 ]._semi = 0 ;
430429 ntarjan[0 ]._label = &ntarjan[0 ];
431430
431+ int i;
432432 for ( i = dfsnum-1 ; i>1 ; i-- ) { // For all nodes in reverse DFS order
433433 NTarjan *w = &ntarjan[i]; // Get Node from DFS
434434 assert (w->_control != nullptr ," bad DFS walk" );
You can’t perform that action at this time.
0 commit comments