diff options
author | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-12-02 15:57:15 +0000 |
---|---|---|
committer | Andreas Neustifter <astifter-llvm@gmx.at> | 2009-12-02 15:57:15 +0000 |
commit | 059a983531dd13618fc671c70a175bdb4e87ec47 (patch) | |
tree | efff68668526b2d045cf642f037868142b1d407f /lib | |
parent | 0fea11a8055d179655b9d862f0b2acb93a728114 (diff) | |
download | external_llvm-059a983531dd13618fc671c70a175bdb4e87ec47.zip external_llvm-059a983531dd13618fc671c70a175bdb4e87ec47.tar.gz external_llvm-059a983531dd13618fc671c70a175bdb4e87ec47.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Instrumentation/MaximumSpanningTree.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/MaximumSpanningTree.h b/lib/Transforms/Instrumentation/MaximumSpanningTree.h index 2951dbc..829da6b 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 <vector> #include <algorithm> @@ -33,6 +34,18 @@ namespace llvm { typename MaximumSpanningTree<CT>::EdgeWeight Y) const { if (X.second > Y.second) return true; if (X.second < Y.second) return false; + if (const BasicBlock *BBX = dyn_cast<BasicBlock>(X.first.first)) { + if (const BasicBlock *BBY = dyn_cast<BasicBlock>(Y.first.first)) { + if (BBX->size() > BBY->size()) return true; + if (BBX->size() < BBY->size()) return false; + } + } + if (const BasicBlock *BBX = dyn_cast<BasicBlock>(X.first.second)) { + if (const BasicBlock *BBY = dyn_cast<BasicBlock>(Y.first.second)) { + if (BBX->size() > BBY->size()) return true; + if (BBX->size() < BBY->size()) return false; + } + } return false; } }; |