[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GVNPRE.cpp
Owen Anderson
resistor at mac.com
Sun Jun 3 15:02:36 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
GVNPRE.cpp updated: 1.13 -> 1.14
---
Log message:
Don't use the custom comparator where it's not necessary.
---
Diffs of the changes: (+22 -13)
GVNPRE.cpp | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
Index: llvm/lib/Transforms/Scalar/GVNPRE.cpp
diff -u llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.13 llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.14
--- llvm/lib/Transforms/Scalar/GVNPRE.cpp:1.13 Sun Jun 3 01:26:14 2007
+++ llvm/lib/Transforms/Scalar/GVNPRE.cpp Sun Jun 3 17:02:14 2007
@@ -73,7 +73,8 @@
// Helper fuctions
// FIXME: eliminate or document these better
- void dump(ValueTable& VN, std::set<Value*, ExprLT>& s);
+ void dump(ValueTable& VN, std::set<Value*>& s);
+ void dump_unique(ValueTable& VN, std::set<Value*, ExprLT>& s);
void clean(ValueTable VN, std::set<Value*, ExprLT>& set);
bool add(ValueTable& VN, std::set<Value*, ExprLT>& MS, Value* V);
Value* find_leader(ValueTable VN, std::set<Value*, ExprLT>& vals, uint32_t v);
@@ -90,7 +91,7 @@
DominatorTree::DomTreeNode* DI,
std::set<Value*, ExprLT>& currExps,
std::set<PHINode*>& currPhis,
- std::set<Value*, ExprLT>& currTemps,
+ std::set<Value*>& currTemps,
std::set<Value*, ExprLT>& currAvail,
std::map<BasicBlock*, std::set<Value*, ExprLT> > availOut);
@@ -250,11 +251,19 @@
}
}
-void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set<Value*, ExprLT>& s) {
- std::vector<Value*> sorted;
- topo_sort(VN, s, sorted);
+
+void GVNPRE::dump(GVNPRE::ValueTable& VN, std::set<Value*>& s) {
DOUT << "{ ";
- for (std::vector<Value*>::iterator I = sorted.begin(), E = sorted.end();
+ for (std::set<Value*>::iterator I = s.begin(), E = s.end();
+ I != E; ++I) {
+ DEBUG((*I)->dump());
+ }
+ DOUT << "}\n\n";
+}
+
+void GVNPRE::dump_unique(GVNPRE::ValueTable& VN, std::set<Value*, ExprLT>& s) {
+ DOUT << "{ ";
+ for (std::set<Value*>::iterator I = s.begin(), E = s.end();
I != E; ++I) {
DEBUG((*I)->dump());
}
@@ -265,7 +274,7 @@
DominatorTree::DomTreeNode* DI,
std::set<Value*, ExprLT>& currExps,
std::set<PHINode*>& currPhis,
- std::set<Value*, ExprLT>& currTemps,
+ std::set<Value*>& currTemps,
std::set<Value*, ExprLT>& currAvail,
std::map<BasicBlock*, std::set<Value*, ExprLT> > availOut) {
@@ -297,7 +306,7 @@
currExps.insert(BO);
currTemps.insert(BO);
-
+
// Handle unsupported ops
} else if (!BI->isTerminator()){
add(VN, MS, BI);
@@ -315,7 +324,7 @@
std::map<BasicBlock*, std::set<Value*, ExprLT> > generatedExpressions;
std::map<BasicBlock*, std::set<PHINode*> > generatedPhis;
- std::map<BasicBlock*, std::set<Value*, ExprLT> > generatedTemporaries;
+ std::map<BasicBlock*, std::set<Value*> > generatedTemporaries;
std::map<BasicBlock*, std::set<Value*, ExprLT> > availableOut;
std::map<BasicBlock*, std::set<Value*, ExprLT> > anticipatedIn;
@@ -330,7 +339,7 @@
// Get the sets to update for this block
std::set<Value*, ExprLT>& currExps = generatedExpressions[DI->getBlock()];
std::set<PHINode*>& currPhis = generatedPhis[DI->getBlock()];
- std::set<Value*, ExprLT>& currTemps = generatedTemporaries[DI->getBlock()];
+ std::set<Value*>& currTemps = generatedTemporaries[DI->getBlock()];
std::set<Value*, ExprLT>& currAvail = availableOut[DI->getBlock()];
CalculateAvailOut(VN, maximalSet, *DI, currExps, currPhis,
@@ -423,15 +432,15 @@
DOUT << "\n";
DOUT << "EXP_GEN: ";
- dump(VN, generatedExpressions[I]);
+ dump_unique(VN, generatedExpressions[I]);
DOUT << "\n";
DOUT << "ANTIC_IN: ";
- dump(VN, anticipatedIn[I]);
+ dump_unique(VN, anticipatedIn[I]);
DOUT << "\n";
DOUT << "AVAIL_OUT: ";
- dump(VN, availableOut[I]);
+ dump_unique(VN, availableOut[I]);
DOUT << "\n";
}
More information about the llvm-commits
mailing list