diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-02-15 19:41:52 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-02-15 19:41:52 +0000 |
| commit | 7907e5fe07d109a0f6281859597eebcbde98a7b9 (patch) | |
| tree | 9126812cdb4f7f937b94e18f9cb5502664df6e83 /llvm/lib/Transforms | |
| parent | 7a259ffba3809e686077ffc6fc718a0f5b581a54 (diff) | |
| download | bcm5719-llvm-7907e5fe07d109a0f6281859597eebcbde98a7b9.tar.gz bcm5719-llvm-7907e5fe07d109a0f6281859597eebcbde98a7b9.zip | |
switch an std::set to a SmallPtr set, this speeds up instcombine by 9.5%
on 447.dealII
llvm-svn: 34323
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 65b1eb4a0f0..b5576179986 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -51,6 +51,7 @@ #include "llvm/Support/PatternMatch.h" #include "llvm/Support/Compiler.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include <algorithm> @@ -9088,11 +9089,11 @@ static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) { /// whose condition is a known constant, we only visit the reachable successors. /// static void AddReachableCodeToWorklist(BasicBlock *BB, - std::set<BasicBlock*> &Visited, + SmallPtrSet<BasicBlock*, 64> &Visited, std::vector<Instruction*> &WorkList, const TargetData *TD) { // We have now visited this block! If we've already been here, bail out. - if (!Visited.insert(BB).second) return; + if (!Visited.insert(BB)) return; for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { Instruction *Inst = BBI++; @@ -9154,7 +9155,7 @@ bool InstCombiner::runOnFunction(Function &F) { // Do a depth-first traversal of the function, populate the worklist with // the reachable instructions. Ignore blocks that are not reachable. Keep // track of which blocks we visit. - std::set<BasicBlock*> Visited; + SmallPtrSet<BasicBlock*, 64> Visited; AddReachableCodeToWorklist(F.begin(), Visited, WorkList, TD); // Do a quick scan over the function. If we find any blocks that are |

