aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-08-04 02:21:22 +0000
committerChris Lattner <sabre@nondot.org>2007-08-04 02:21:22 +0000
commitc3f6ea83302dfd8e1b6d77bb6c99ecacdd6bc375 (patch)
treeba85a5469242af861a669c9593784c9e37735288 /lib/Transforms/Utils/PromoteMemoryToRegister.cpp
parentb776a335b1a3260c27555db31f7ea0bee605de04 (diff)
switch from using a std::set to using a SmallPtrSet. This speeds up the
testcase in PR1432 from 6.33s to 2.90s (2.22x) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/PromoteMemoryToRegister.cpp')
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 5ec5d182c7..8fb9124a5f 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -534,7 +534,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI,
StoreInst *OnlyStore = Info.OnlyStore;
// Be aware of loads before the store.
- std::set<BasicBlock*> ProcessedBlocks;
+ SmallPtrSet<BasicBlock*, 32> ProcessedBlocks;
for (unsigned i = 0, e = Info.UsingBlocks.size(); i != e; ++i) {
// If the store dominates the block and if we haven't processed it yet,
// do so now.
@@ -542,7 +542,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI,
continue;
BasicBlock *UseBlock = Info.UsingBlocks[i];
- if (!ProcessedBlocks.insert(UseBlock).second)
+ if (!ProcessedBlocks.insert(UseBlock))
continue;
// If the use and store are in the same block, do a quick scan to
@@ -559,7 +559,7 @@ void PromoteMem2Reg::RewriteSingleStoreAlloca(AllocaInst *AI,
// Otherwise, if this is a different block or if all uses happen
// after the store, do a simple linear scan to replace loads with
// the stored value.
- for (BasicBlock::iterator I = UseBlock->begin(),E = UseBlock->end();
+ for (BasicBlock::iterator I = UseBlock->begin(), E = UseBlock->end();
I != E; ) {
if (LoadInst *LI = dyn_cast<LoadInst>(I++)) {
if (LI->getOperand(0) == AI) {