From 059a983531dd13618fc671c70a175bdb4e87ec47 Mon Sep 17 00:00:00 2001 From: Andreas Neustifter Date: Wed, 2 Dec 2009 15:57:15 +0000 Subject: [PATCH] Cheap, mostly strict, stable sorting. This is necessary for tests so the results are comparable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90320 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Instrumentation/MaximumSpanningTree.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/Transforms/Instrumentation/MaximumSpanningTree.h b/lib/Transforms/Instrumentation/MaximumSpanningTree.h index 2951dbcea9a..829da6b295d 100644 --- a/lib/Transforms/Instrumentation/MaximumSpanningTree.h +++ b/lib/Transforms/Instrumentation/MaximumSpanningTree.h @@ -15,6 +15,7 @@ #ifndef LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H #define LLVM_ANALYSIS_MAXIMUMSPANNINGTREE_H +#include "llvm/BasicBlock.h" #include "llvm/ADT/EquivalenceClasses.h" #include #include @@ -33,6 +34,18 @@ namespace llvm { typename MaximumSpanningTree::EdgeWeight Y) const { if (X.second > Y.second) return true; if (X.second < Y.second) return false; + if (const BasicBlock *BBX = dyn_cast(X.first.first)) { + if (const BasicBlock *BBY = dyn_cast(Y.first.first)) { + if (BBX->size() > BBY->size()) return true; + if (BBX->size() < BBY->size()) return false; + } + } + if (const BasicBlock *BBX = dyn_cast(X.first.second)) { + if (const BasicBlock *BBY = dyn_cast(Y.first.second)) { + if (BBX->size() > BBY->size()) return true; + if (BBX->size() < BBY->size()) return false; + } + } return false; } }; -- 2.34.1