summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-10 00:27:22 +0000
committerOwen Anderson <resistor@mac.com>2007-07-10 00:27:22 +0000
commit4c4b2384480ae83850ad2b59fd5cc7d29c7ea873 (patch)
treed3de06affef11548cd249bfd314eeef3e6fcbf08 /llvm/lib/Transforms
parent41c2cab8730a85edd7cadca305948e87b0569c08 (diff)
downloadbcm5719-llvm-4c4b2384480ae83850ad2b59fd5cc7d29c7ea873.tar.gz
bcm5719-llvm-4c4b2384480ae83850ad2b59fd5cc7d29c7ea873.zip
Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
to 15.7s. llvm-svn: 38480
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVNPRE.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVNPRE.cpp b/llvm/lib/Transforms/Scalar/GVNPRE.cpp
index 007c6777195..96870e3fdf2 100644
--- a/llvm/lib/Transforms/Scalar/GVNPRE.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNPRE.cpp
@@ -556,6 +556,10 @@ class ValueNumberedSet {
BitVector numbers;
public:
ValueNumberedSet() { numbers.resize(1); }
+ ValueNumberedSet(const ValueNumberedSet& other) {
+ numbers = other.numbers;
+ contents = other.contents;
+ }
typedef SmallPtrSet<Value*, 8>::iterator iterator;
@@ -614,9 +618,9 @@ namespace {
ValueTable VN;
std::vector<Instruction*> createdExpressions;
- std::map<BasicBlock*, ValueNumberedSet> availableOut;
- std::map<BasicBlock*, ValueNumberedSet> anticipatedIn;
- std::map<BasicBlock*, ValueNumberedSet> generatedPhis;
+ DenseMap<BasicBlock*, ValueNumberedSet> availableOut;
+ DenseMap<BasicBlock*, ValueNumberedSet> anticipatedIn;
+ DenseMap<BasicBlock*, ValueNumberedSet> generatedPhis;
// This transformation requires dominator postdominator info
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -1175,7 +1179,7 @@ bool GVNPRE::elimination() {
isa<ExtractElementInst>(BI) || isa<SelectInst>(BI) ||
isa<CastInst>(BI) || isa<GetElementPtrInst>(BI)) {
- if (availableOut[BB].test(VN.lookup(BI)) && ! availableOut[BB].count(BI)) {
+ if (availableOut[BB].test(VN.lookup(BI)) && !availableOut[BB].count(BI)) {
Value *leader = find_leader(availableOut[BB], VN.lookup(BI));
if (Instruction* Instr = dyn_cast<Instruction>(leader))
if (Instr->getParent() != 0 && Instr != BI) {
OpenPOWER on IntegriCloud