summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-03-04 04:20:48 +0000
committerChris Lattner <sabre@nondot.org>2007-03-04 04:20:48 +0000
commita5403a587c5a4be7dc42f8c80401c9b6fceca360 (patch)
tree780bb6bc6f5b0ed7698321d7348867370b082bfd /llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
parent16cf9a7686c3bcbf55fd6a19281e293be1f7992a (diff)
downloadbcm5719-llvm-a5403a587c5a4be7dc42f8c80401c9b6fceca360.tar.gz
bcm5719-llvm-a5403a587c5a4be7dc42f8c80401c9b6fceca360.zip
switch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
up simplifycfg by 20% llvm-svn: 34901
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimplifyCFG.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
index 97ea9f4ce55..659f34f2ef9 100644
--- a/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
@@ -27,8 +27,8 @@
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Pass.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
-#include <set>
using namespace llvm;
STATISTIC(NumSimpl, "Number of blocks simplified");
@@ -45,9 +45,9 @@ FunctionPass *llvm::createCFGSimplificationPass() {
return new CFGSimplifyPass();
}
-static bool MarkAliveBlocks(BasicBlock *BB, std::set<BasicBlock*> &Reachable) {
- if (Reachable.count(BB)) return false;
- Reachable.insert(BB);
+static bool MarkAliveBlocks(BasicBlock *BB,
+ SmallPtrSet<BasicBlock*, 16> &Reachable) {
+ if (!Reachable.insert(BB)) return false;
// Do a quick scan of the basic block, turning any obviously unreachable
// instructions into LLVM unreachable insts. The instruction combining pass
@@ -85,7 +85,7 @@ static bool MarkAliveBlocks(BasicBlock *BB, std::set<BasicBlock*> &Reachable) {
// simplify the CFG.
//
bool CFGSimplifyPass::runOnFunction(Function &F) {
- std::set<BasicBlock*> Reachable;
+ SmallPtrSet<BasicBlock*, 16> Reachable;
bool Changed = MarkAliveBlocks(F.begin(), Reachable);
// If there are unreachable blocks in the CFG...
OpenPOWER on IntegriCloud