mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
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:
parent
c354334ac4
commit
aa7d3351f0
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user