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() {
410
410
// Setup mappings from my Graph to Tarjan's stuff and back
411
411
// Note: Tarjan uses 1-based arrays
412
412
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));
417
416
418
417
// Store the DFS order for the main loop
419
418
const uint fill_value = max_juint;
@@ -429,6 +428,7 @@ void PhaseIdealLoop::Dominators() {
429
428
ntarjan[0 ]._size = ntarjan[0 ]._semi = 0 ;
430
429
ntarjan[0 ]._label = &ntarjan[0 ];
431
430
431
+ int i;
432
432
for ( i = dfsnum-1 ; i>1 ; i-- ) { // For all nodes in reverse DFS order
433
433
NTarjan *w = &ntarjan[i]; // Get Node from DFS
434
434
assert (w->_control != nullptr ," bad DFS walk" );
You can’t perform that action at this time.
0 commit comments