diff options
author | Owen Anderson <resistor@mac.com> | 2007-07-10 00:27:22 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-07-10 00:27:22 +0000 |
commit | 81c2a6ecbb3408b1d99f426d194a051f6284a936 (patch) | |
tree | 63b25edf5cc9f0f83d33d29942b553ee64dd7792 | |
parent | a05a81b10ae6e2fc4f22a59bdb7c7417cca41cfd (diff) |
Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
to 15.7s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38480 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/GVNPRE.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 007c677719..96870e3fdf 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/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) { |