aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp
diff options
context:
space:
mode:
authorAndreas Neustifter <astifter-llvm@gmx.at>2009-09-03 08:52:52 +0000
committerAndreas Neustifter <astifter-llvm@gmx.at>2009-09-03 08:52:52 +0000
commit39859438715fc8f9ff16d7cec6cf2a9cb2ac0803 (patch)
tree0de61a7a44475a2107c36cc7aef8355305d190cc /lib/Transforms/Instrumentation/MaximumSpanningTree.cpp
parentaa60dbfb37ac272541b11fa4a52f57ebcd259e44 (diff)
Code Cleanup.
Removed inverted flag form MaximumSpanningTree, also do not handle so much information to MaximumSpanningTree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/MaximumSpanningTree.cpp')
-rw-r--r--lib/Transforms/Instrumentation/MaximumSpanningTree.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp b/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp
index ffd100e053..19c4a83f76 100644
--- a/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp
+++ b/lib/Transforms/Instrumentation/MaximumSpanningTree.cpp
@@ -14,8 +14,6 @@
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "maximum-spanning-tree"
#include "MaximumSpanningTree.h"
-#include "llvm/Pass.h"
-#include "llvm/Analysis/Passes.h"
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/CFG.h"
@@ -64,12 +62,9 @@ static void inline printMSTEdge(ProfileInfo::EdgeWeight E,
// MaximumSpanningTree() - Takes a function and returns a spanning tree
// according to the currently active profiling information, the leaf edges are
// NOT in the MST. MaximumSpanningTree uses the algorithm of Kruskal.
-MaximumSpanningTree::MaximumSpanningTree(Function *F, ProfileInfo *PI,
- bool inverted = false) {
+MaximumSpanningTree::MaximumSpanningTree(std::vector<ProfileInfo::EdgeWeight>
+ &EdgeVector) {
- // Copy edges to vector, sort them biggest first.
- ProfileInfo::EdgeWeights ECs = PI->getEdgeWeights(F);
- std::vector<ProfileInfo::EdgeWeight> EdgeVector(ECs.begin(), ECs.end());
std::sort(EdgeVector.begin(), EdgeVector.end(), EdgeWeightCompare());
// Create spanning tree, Forest contains a special data structure
@@ -92,12 +87,11 @@ MaximumSpanningTree::MaximumSpanningTree(Function *F, ProfileInfo *PI,
Forest.unionSets(e.first, e.second);
// So we know now that the edge is not already in a subtree (and not
// (0,entry)), so we push the edge to the MST if it has some successors.
- if (!inverted) { MST.push_back(e); }
+ MST.push_back(e);
printMSTEdge(*bbi,"in MST");
} else {
// This edge is either (0,entry) or (BB,0) or would create a circle in a
// subtree.
- if (inverted) { MST.push_back(e); }
printMSTEdge(*bbi,"*not* in MST");
}
}