From ed1ac4ae8eadb907ec6a41bb74cae1777a4e28d2 Mon Sep 17 00:00:00 2001 From: Andreas Neustifter Date: Fri, 4 Sep 2009 12:34:44 +0000 Subject: Converted MaximumSpanningTree algorithm to a generic template, this could go into llvm/ADT. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81001 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp') diff --git a/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp b/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp index 2c06423872..cdaf5f1b0d 100644 --- a/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp +++ b/lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp @@ -17,6 +17,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Analysis/Passes.h" +#include "llvm/Analysis/ProfileInfo.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Debug.h" @@ -131,7 +132,8 @@ bool OptimalEdgeProfiler::runOnModule(Module &M) { ProfileInfo::EdgeWeights ECs = getAnalysisID(ProfileEstimatorPassID, *F).getEdgeWeights(F); std::vector EdgeVector(ECs.begin(), ECs.end()); - MaximumSpanningTree MST = MaximumSpanningTree(EdgeVector); + MaximumSpanningTree MST (EdgeVector); + std::stable_sort(MST.begin(),MST.end()); // Check if (0,entry) not in the MST. If not, instrument edge // (IncrementCounterInBlock()) and set the counter initially to zero, if -- cgit v1.2.3