[llvm-commits] [llvm] r40036 - /llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Wed Jul 18 20:32:44 PDT 2007
Author: resistor
Date: Wed Jul 18 22:32:44 2007
New Revision: 40036
URL: http://llvm.org/viewvc/llvm-project?rev=40036&view=rev
Log:
Move some sets and maps to SmallPtrSet and DenseMap respectively. This
reduces the time to optimize 403.gcc from 17.6s to 16.4s.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=40036&r1=40035&r2=40036&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Wed Jul 18 22:32:44 2007
@@ -39,7 +39,6 @@
#include <deque>
#include <map>
#include <vector>
-#include <set>
using namespace llvm;
//===----------------------------------------------------------------------===//
@@ -655,12 +654,12 @@
SmallPtrSet<Value*, 16>& currTemps) ;
bool buildsets_anticout(BasicBlock* BB,
ValueNumberedSet& anticOut,
- std::set<BasicBlock*>& visited) ;
+ SmallPtrSet<BasicBlock*, 8>& visited) ;
unsigned buildsets_anticin(BasicBlock* BB,
ValueNumberedSet& anticOut,
ValueNumberedSet& currExps,
SmallPtrSet<Value*, 16>& currTemps,
- std::set<BasicBlock*>& visited) ;
+ SmallPtrSet<BasicBlock*, 8>& visited) ;
void buildsets(Function& F) ;
void insertion_pre(Value* e, BasicBlock* BB,
@@ -1351,7 +1350,7 @@
/// set as a function of the ANTIC_IN set of the block's predecessors
bool GVNPRE::buildsets_anticout(BasicBlock* BB,
ValueNumberedSet& anticOut,
- std::set<BasicBlock*>& visited) {
+ SmallPtrSet<BasicBlock*, 8>& visited) {
if (BB->getTerminator()->getNumSuccessors() == 1) {
if (BB->getTerminator()->getSuccessor(0) != BB &&
visited.count(BB->getTerminator()->getSuccessor(0)) == 0) {
@@ -1398,7 +1397,7 @@
ValueNumberedSet& anticOut,
ValueNumberedSet& currExps,
SmallPtrSet<Value*, 16>& currTemps,
- std::set<BasicBlock*>& visited) {
+ SmallPtrSet<BasicBlock*, 8>& visited) {
ValueNumberedSet& anticIn = anticipatedIn[BB];
unsigned old = anticIn.size();
@@ -1439,8 +1438,8 @@
/// buildsets - Phase 1 of the main algorithm. Construct the AVAIL_OUT
/// and the ANTIC_IN sets.
void GVNPRE::buildsets(Function& F) {
- std::map<BasicBlock*, ValueNumberedSet> generatedExpressions;
- std::map<BasicBlock*, SmallPtrSet<Value*, 16> > generatedTemporaries;
+ DenseMap<BasicBlock*, ValueNumberedSet> generatedExpressions;
+ DenseMap<BasicBlock*, SmallPtrSet<Value*, 16> > generatedTemporaries;
DominatorTree &DT = getAnalysis<DominatorTree>();
@@ -1471,7 +1470,7 @@
// Phase 1, Part 2: calculate ANTIC_IN
- std::set<BasicBlock*> visited;
+ SmallPtrSet<BasicBlock*, 8> visited;
SmallPtrSet<BasicBlock*, 4> block_changed;
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
block_changed.insert(FI);
More information about the llvm-commits
mailing list