From 9b32d3f494ac3396b6a6e7b4606eba16be73cb99 Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Wed, 12 Jun 2024 18:52:41 -0700 Subject: [PATCH] fix for ZBody traversal --- src/script_opt/ProfileFunc.cc | 9 ++++----- src/script_opt/ZAM/ZBody.cc | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/script_opt/ProfileFunc.cc b/src/script_opt/ProfileFunc.cc index 6d4072473c..7b1d421d03 100644 --- a/src/script_opt/ProfileFunc.cc +++ b/src/script_opt/ProfileFunc.cc @@ -522,11 +522,10 @@ void ProfileFunc::TrackID(const ID* id) { // Already tracked. return; - if ( id->IsGlobal() ) - { - globals.insert(id); - all_globals.insert(id); - } + if ( id->IsGlobal() ) { + globals.insert(id); + all_globals.insert(id); + } ordered_ids.push_back(id); } diff --git a/src/script_opt/ZAM/ZBody.cc b/src/script_opt/ZAM/ZBody.cc index 03677d9d42..3c751fa47c 100644 --- a/src/script_opt/ZAM/ZBody.cc +++ b/src/script_opt/ZAM/ZBody.cc @@ -591,6 +591,11 @@ TraversalCode ZBody::Traverse(TraversalCallback* cb) const { TraversalCode tc = cb->PreStmt(this); HANDLE_TC_STMT_PRE(tc); + for ( auto& gi : globals ) { + tc = gi.id->Traverse(cb); + HANDLE_TC_STMT_PRE(tc); + } + for ( size_t i = 0; i < NumInsts(); ++i ) { tc = insts[i].Traverse(cb); HANDLE_TC_STMT_PRE(tc);