aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-05 23:37:20 +0000
committerChris Lattner <sabre@nondot.org>2007-02-05 23:37:20 +0000
commitd3874049a55fe1af515c4f0d8f5a4040803567cb (patch)
treeb39f063ad6cb99f1c067b0b65139dcd2c0a8f024
parent9133fe28954d498fc4de13064c7d65bd811de02c (diff)
downloadexternal_llvm-d3874049a55fe1af515c4f0d8f5a4040803567cb.zip
external_llvm-d3874049a55fe1af515c4f0d8f5a4040803567cb.tar.gz
external_llvm-d3874049a55fe1af515c4f0d8f5a4040803567cb.tar.bz2
With the last change, we no longer need both directions of mapping from
BBNumbers. Instead of using a bi-directional mapping, just use a single densemap. This speeds up mem2reg on 176.gcc by 8%, from 1.3489 to 1.2485s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33940 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 7a5828d..28f59d3 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -23,11 +23,11 @@
#include "llvm/Instructions.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/AliasSetTracker.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CFG.h"
-#include "llvm/Support/StableBasicBlockNumbering.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
using namespace llvm;
@@ -88,7 +88,7 @@ namespace {
/// BBNumbers - Contains a stable numbering of basic blocks to avoid
/// non-determinstic behavior.
- StableBasicBlockNumbering BBNumbers;
+ DenseMap<BasicBlock*, unsigned> BBNumbers;
public:
PromoteMem2Reg(const std::vector<AllocaInst*> &A,
@@ -265,7 +265,11 @@ void PromoteMem2Reg::run() {
// If we haven't computed a numbering for the BB's in the function, do so
// now.
- BBNumbers.compute(F);
+ if (BBNumbers.empty()) {
+ unsigned ID = 0;
+ for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
+ BBNumbers[I] = ID++;
+ }
// Compute the locations where PhiNodes need to be inserted. Look at the
// dominance frontier of EACH basic-block we have a write in.
@@ -289,7 +293,7 @@ void PromoteMem2Reg::run() {
// processing blocks in order of the occurance in the function.
for (DominanceFrontier::DomSetType::const_iterator P = S.begin(),
PE = S.end(); P != PE; ++P)
- DFBlocks.push_back(std::make_pair(BBNumbers.getNumber(*P), *P));
+ DFBlocks.push_back(std::make_pair(BBNumbers[*P], *P));
// Sort by which the block ordering in the function.
std::sort(DFBlocks.begin(), DFBlocks.end());