aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/EarlyCSE.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-03 01:42:46 +0000
committerChris Lattner <sabre@nondot.org>2011-01-03 01:42:46 +0000
commit82dcd5edd22f017b74ebe98acc07b3a7191e7ff1 (patch)
treebdea8fc9930a01dd3676b5799c855daac6403d61 /lib/Transforms/Scalar/EarlyCSE.cpp
parent4f20c6d354d4c6eba00148c2dfc9ad2dae8fd140 (diff)
downloadexternal_llvm-82dcd5edd22f017b74ebe98acc07b3a7191e7ff1.tar.gz
external_llvm-82dcd5edd22f017b74ebe98acc07b3a7191e7ff1.tar.bz2
external_llvm-82dcd5edd22f017b74ebe98acc07b3a7191e7ff1.zip
Allocate nodes for the scoped hash table from a recyling bump pointer
allocator. This speeds up early cse by about 20% git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/EarlyCSE.cpp')
-rw-r--r--lib/Transforms/Scalar/EarlyCSE.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/EarlyCSE.cpp b/lib/Transforms/Scalar/EarlyCSE.cpp
index 4399e2ee1f..99a09923f4 100644
--- a/lib/Transforms/Scalar/EarlyCSE.cpp
+++ b/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<InstValue, Instruction*> *AvailableValues;
+ typedef RecyclingAllocator<BumpPtrAllocator,
+ ScopedHashTableVal<InstValue, Instruction*> > AllocatorTy;
+ typedef ScopedHashTable<InstValue, Instruction*, DenseMapInfo<InstValue>,
+ 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<InstValue, Instruction*> Scope(*AvailableValues);
+ ScopedHashTableScope<InstValue, Instruction*, DenseMapInfo<InstValue>,
+ AllocatorTy> Scope(*AvailableValues);
BasicBlock *BB = Node->getBlock();
@@ -228,7 +232,7 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
bool EarlyCSE::runOnFunction(Function &F) {
TD = getAnalysisIfAvailable<TargetData>();
DT = &getAnalysis<DominatorTree>();
- ScopedHashTable<InstValue, Instruction*> AVTable;
+ ScopedHTType AVTable;
AvailableValues = &AVTable;
return processNode(DT->getRootNode());
}