Skip to content

Commit

Permalink
Merge pull request #7305 from hzongaro/deadTreesElimination-TreeInfo-…
Browse files Browse the repository at this point in the history
…allocation

Allocate TreeInfo objects using TR::Region of containing List
  • Loading branch information
vijaysun-omr authored Apr 23, 2024
2 parents 15eb2a8 + 149b872 commit e2d8e0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions compiler/optimizer/DeadTreesElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static OMR::TreeInfo *findOrCreateTreeInfo(TR::TreeTop *treeTop, List<OMR::TreeI
return t;
}

t = new (comp->trStackMemory()) OMR::TreeInfo(treeTop, 0);
t = new (targetTrees->getRegion()) OMR::TreeInfo(treeTop, 0);
targetTrees->add(t);
return t;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
*
Expand Down Expand Up @@ -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<OMR::TreeInfo> targetTrees(stackRegion);

LongestPathMap longestPaths(std::less<TR::Node*>(), stackRegion);

typedef TR::typed_allocator<CRAnchor, TR::Region&> CRAnchorAlloc;
Expand Down Expand Up @@ -894,7 +894,7 @@ int32_t TR::DeadTreesElimination::process(TR::TreeTop *startTree, TR::TreeTop *e
visitCount,
comp(),
this,
&_targetTrees,
&targetTrees,
_cannotBeEliminated,
longestPaths);
}
Expand Down
1 change: 0 additions & 1 deletion compiler/optimizer/DeadTreesElimination.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ class DeadTreesElimination : public TR::Optimization

int32_t process(TR::TreeTop *, TR::TreeTop *);

List<OMR::TreeInfo> _targetTrees;
bool _cannotBeEliminated;
bool _delayedRegStores;
};
Expand Down

0 comments on commit e2d8e0f

Please sign in to comment.