mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 19:32:16 +00:00
Sort edges in MaximumSpanningTree more stable in case of equal weight.
(See http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090824/085890.html) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80789 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8f123b85c6
commit
2252d481d6
@ -30,7 +30,11 @@ namespace {
|
||||
const ProfileInfo::EdgeWeight Y) const {
|
||||
if (X.second > Y.second) return true;
|
||||
if (X.second < Y.second) return false;
|
||||
#ifndef NDEBUG
|
||||
|
||||
// It would be enough to just compare the weights of the edges and be
|
||||
// done. With edges of the same weight this may lead to a different MST
|
||||
// each time the MST is created. To have more stable sorting (and thus
|
||||
// more stable MSTs) furhter sort the edges.
|
||||
if (X.first.first != 0 && Y.first.first == 0) return true;
|
||||
if (X.first.first == 0 && Y.first.first != 0) return false;
|
||||
if (X.first.first == 0 && Y.first.first == 0) return false;
|
||||
@ -44,7 +48,7 @@ namespace {
|
||||
|
||||
if (X.first.second->size() > Y.first.second->size()) return true;
|
||||
if (X.first.second->size() < Y.first.second->size()) return false;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user