clean() needs to process things in topological order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37389 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-06-01 22:00:37 +00:00
parent c354334ac4
commit aa7d3351f0

View File

@ -299,13 +299,9 @@ void GVNPRE::phi_translate(GVNPRE::ValueTable& VN,
// Remove all expressions whose operands are not themselves in the set
void GVNPRE::clean(GVNPRE::ValueTable VN, std::set<GVNPRE::Expression>& set) {
unsigned size = set.size();
unsigned old = 0;
std::vector<Expression> worklist;
topo_sort(VN, set, worklist);
while (size != old) {
old = size;
std::vector<Expression> worklist(set.begin(), set.end());
while (!worklist.empty()) {
Expression e = worklist.back();
worklist.pop_back();
@ -328,9 +324,6 @@ void GVNPRE::clean(GVNPRE::ValueTable VN, std::set<GVNPRE::Expression>& set) {
if (!lhsValid || !rhsValid)
set.erase(e);
}
size = set.size();
}
}
void GVNPRE::topo_sort(GVNPRE::ValueTable& VN,