Collect statistics from GVN-PRE.

llvm-svn: 37530
This commit is contained in:
Owen Anderson 2007-06-08 22:02:36 +00:00
parent 288f1545a6
commit 7d76b2a774
1 changed files with 9 additions and 0 deletions

View File

@ -114,6 +114,10 @@ RegisterPass<GVNPRE> X("gvnpre",
"Global Value Numbering/Partial Redundancy Elimination"); "Global Value Numbering/Partial Redundancy Elimination");
STATISTIC(NumInsertedVals, "Number of values inserted");
STATISTIC(NumInsertedPhis, "Number of PHI nodes inserted");
STATISTIC(NumEliminated, "Number of redundant instructions eliminated");
bool GVNPRE::add(Value* V, uint32_t number) { bool GVNPRE::add(Value* V, uint32_t number) {
std::pair<ValueTable::iterator, bool> ret = VN.insert(std::make_pair(V, number)); std::pair<ValueTable::iterator, bool> ret = VN.insert(std::make_pair(V, number));
@ -618,6 +622,8 @@ bool GVNPRE::runOnFunction(Function &F) {
if (av != avail.end()) if (av != avail.end())
avail.erase(av); avail.erase(av);
avail.insert(std::make_pair(*PI, newVal)); avail.insert(std::make_pair(*PI, newVal));
++NumInsertedVals;
} }
} }
@ -655,6 +661,8 @@ bool GVNPRE::runOnFunction(Function &F) {
DOUT << "\n\n"; DOUT << "\n\n";
new_set.insert(p); new_set.insert(p);
++NumInsertedPhis;
} }
} }
} }
@ -688,6 +696,7 @@ bool GVNPRE::runOnFunction(Function &F) {
if (Instr->getParent() != 0 && Instr != BI) { if (Instr->getParent() != 0 && Instr != BI) {
replace.push_back(std::make_pair(BI, leader)); replace.push_back(std::make_pair(BI, leader));
erase.push_back(BI); erase.push_back(BI);
++NumEliminated;
} }
} }
} }