From 55566a972ca7fe1f543a4d43ec5ad2b73ee20944 Mon Sep 17 00:00:00 2001 From: Devang Patel <dpatel@apple.com> Date: Mon, 26 Mar 2007 23:17:19 +0000 Subject: [PATCH] Use std::vector<DFCalculateWorkObject> instead of std::vector<DFCalculateWorkObject *> to reduce malloc/free traffic. llvm-svn: 35368 --- llvm/lib/VMCore/Dominators.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/llvm/lib/VMCore/Dominators.cpp b/llvm/lib/VMCore/Dominators.cpp index fab353958b33..a0e818fc313d 100644 --- a/llvm/lib/VMCore/Dominators.cpp +++ b/llvm/lib/VMCore/Dominators.cpp @@ -455,13 +455,12 @@ DominanceFrontier::calculate(const DominatorTree &DT, BasicBlock *BB = Node->getBlock(); DomSetType *Result = NULL; - std::vector<DFCalculateWorkObject *> workList; + std::vector<DFCalculateWorkObject> workList; std::set<BasicBlock *> visited; - DFCalculateWorkObject *W = new DFCalculateWorkObject(BB, NULL, Node, NULL); - workList.push_back(W); + workList.push_back(DFCalculateWorkObject(BB, NULL, Node, NULL)); do { - DFCalculateWorkObject *currentW = workList.back(); + DFCalculateWorkObject *currentW = &workList.back(); assert (currentW && "Missing work object."); BasicBlock *currentBB = currentW->currentBB; @@ -494,9 +493,7 @@ DominanceFrontier::calculate(const DominatorTree &DT, DominatorTree::Node *IDominee = *NI; BasicBlock *childBB = IDominee->getBlock(); if (visited.count(childBB) == 0) { - DFCalculateWorkObject *newW = - new DFCalculateWorkObject(childBB, currentBB, IDominee, currentNode); - workList.push_back(newW); + workList.push_back(DFCalculateWorkObject(childBB, currentBB, IDominee, currentNode)); visitChild = true; } }