From d815f69b306ec0d769c3c48a66df0e75ca35f434 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 3 Jan 2011 01:42:46 +0000 Subject: [PATCH] Allocate nodes for the scoped hash table from a recyling bump pointer allocator. This speeds up early cse by about 20% llvm-svn: 122723 --- llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 4399e2ee1fda..99a09923f4ab 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -21,6 +21,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/RecyclingAllocator.h" #include "llvm/ADT/ScopedHashTable.h" #include "llvm/ADT/Statistic.h" using namespace llvm; @@ -132,7 +133,11 @@ class EarlyCSE : public FunctionPass { public: const TargetData *TD; DominatorTree *DT; - ScopedHashTable *AvailableValues; + typedef RecyclingAllocator > AllocatorTy; + typedef ScopedHashTable, + AllocatorTy> ScopedHTType; + ScopedHTType *AvailableValues; static char ID; explicit EarlyCSE() @@ -165,11 +170,10 @@ INITIALIZE_PASS_BEGIN(EarlyCSE, "early-cse", "Early CSE", false, false) INITIALIZE_PASS_DEPENDENCY(DominatorTree) INITIALIZE_PASS_END(EarlyCSE, "early-cse", "Early CSE", false, false) -// FIXME: Should bump pointer allocate entries in scoped hash table. - bool EarlyCSE::processNode(DomTreeNode *Node) { // Define a scope in the scoped hash table. - ScopedHashTableScope Scope(*AvailableValues); + ScopedHashTableScope, + AllocatorTy> Scope(*AvailableValues); BasicBlock *BB = Node->getBlock(); @@ -228,7 +232,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { bool EarlyCSE::runOnFunction(Function &F) { TD = getAnalysisIfAvailable(); DT = &getAnalysis(); - ScopedHashTable AVTable; + ScopedHTType AVTable; AvailableValues = &AVTable; return processNode(DT->getRootNode()); }