[llvm-commits] CVS: llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 3 20:21:05 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
SimplifyCFG.cpp updated: 1.19 -> 1.20
---
Log message:
switch MarkAliveBlocks over to using SmallPtrSet instead of std::set, speeding
up simplifycfg by 20%
---
Diffs of the changes: (+5 -5)
SimplifyCFG.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
Index: llvm/lib/Transforms/Scalar/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.19 llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.20
--- llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.19 Mon Feb 5 17:32:05 2007
+++ llvm/lib/Transforms/Scalar/SimplifyCFG.cpp Sat Mar 3 22:20:48 2007
@@ -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 @@
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 @@
// 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...
More information about the llvm-commits
mailing list