Use properlyDominates in RDFLiveness when sorting on dominance.

Summary:
When looking for all reaching definitions, we sort basic blocks on dominance. When sorting looking for properlyDominates() handles the case A == B.

Authored by: pranavb

Differential Revision: https://reviews.llvm.org/D86661
This commit is contained in:
Alina Sbirlea 2020-08-26 15:03:22 -07:00
parent cf37209c05
commit 9e04c74adc

View File

@ -230,13 +230,12 @@ NodeList Liveness::getAllReachingDefs(RegisterRef RefRR,
TmpBB.push_back(Bucket.first);
if (Bucket.second.size() > 2)
GetOrder(*Bucket.first);
std::sort(Bucket.second.begin(), Bucket.second.end(), Precedes);
llvm::sort(Bucket.second.begin(), Bucket.second.end(), Precedes);
}
// Sort the blocks with respect to dominance.
std::sort(TmpBB.begin(), TmpBB.end(), [this](auto A, auto B) {
return MDT.dominates(A, B);
});
llvm::sort(TmpBB.begin(), TmpBB.end(),
[this](auto A, auto B) { return MDT.properlyDominates(A, B); });
std::vector<NodeId> TmpInst;
for (auto I = TmpBB.rbegin(), E = TmpBB.rend(); I != E; ++I) {