diff --git a/compiler/optimizer/DeadTreesElimination.cpp b/compiler/optimizer/DeadTreesElimination.cpp index bdd6c22f013..d83256a0f9b 100644 --- a/compiler/optimizer/DeadTreesElimination.cpp +++ b/compiler/optimizer/DeadTreesElimination.cpp @@ -73,7 +73,7 @@ static OMR::TreeInfo *findOrCreateTreeInfo(TR::TreeTop *treeTop, ListtrStackMemory()) OMR::TreeInfo(treeTop, 0); + t = new (targetTrees->getRegion()) OMR::TreeInfo(treeTop, 0); targetTrees->add(t); return t; } @@ -433,8 +433,7 @@ TR::Optimization *TR::DeadTreesElimination::create(TR::OptimizationManager *mana TR::DeadTreesElimination::DeadTreesElimination(TR::OptimizationManager *manager) - : TR::Optimization(manager), - _targetTrees(manager->trMemory()) + : TR::Optimization(manager) { _cannotBeEliminated = false; _delayedRegStores = false; @@ -474,8 +473,6 @@ void TR::DeadTreesElimination::prePerformOnBlocks() _cannotBeEliminated = false; _delayedRegStores = false; - _targetTrees.deleteAll(); - /* * Walk through all the blocks to remove trivial dead trees in the following forms: * @@ -759,6 +756,9 @@ static bool treeCanPossiblyBeRemoved(TR::Node *node) int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *endTree) { TR::StackMemoryRegion stackRegion(*comp()->trMemory()); + + List targetTrees(stackRegion); + LongestPathMap longestPaths(std::less(), stackRegion); typedef TR::typed_allocator CRAnchorAlloc; @@ -894,7 +894,7 @@ int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *e visitCount, comp(), this, - &_targetTrees, + &targetTrees, _cannotBeEliminated, longestPaths); } diff --git a/compiler/optimizer/DeadTreesElimination.hpp b/compiler/optimizer/DeadTreesElimination.hpp index 6481a43aefa..c2c854c793e 100644 --- a/compiler/optimizer/DeadTreesElimination.hpp +++ b/compiler/optimizer/DeadTreesElimination.hpp @@ -103,7 +103,6 @@ class DeadTreesElimination : public TR::Optimization int32_t process(TR::TreeTop *, TR::TreeTop *); - List _targetTrees; bool _cannotBeEliminated; bool _delayedRegStores; };