From f91e400b2125067e75e0f2159bca7ffd0cf109a0 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 31 Aug 2012 05:18:31 +0000 Subject: Cleanups due to feedback. No functionality change. Patch by Alistair. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162979 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ProfileDataLoaderPass.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/Analysis/ProfileDataLoaderPass.cpp') diff --git a/lib/Analysis/ProfileDataLoaderPass.cpp b/lib/Analysis/ProfileDataLoaderPass.cpp index 2a61a0b6ed..c43cff05a4 100644 --- a/lib/Analysis/ProfileDataLoaderPass.cpp +++ b/lib/Analysis/ProfileDataLoaderPass.cpp @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "profile-metadata-loader" +#include "llvm/ADT/ArrayRef.h" #include "llvm/BasicBlock.h" #include "llvm/InstrTypes.h" #include "llvm/Module.h" @@ -30,7 +31,6 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Format.h" #include "llvm/ADT/Statistic.h" -#include using namespace llvm; STATISTIC(NumEdgesRead, "The # of edges read."); @@ -63,8 +63,8 @@ namespace { } virtual void readEdge(unsigned, ProfileData&, ProfileData::Edge, - std::vector&); - virtual unsigned matchEdges(Module&, ProfileData&, std::vector&); + ArrayRef); + virtual unsigned matchEdges(Module&, ProfileData&, ArrayRef); virtual void setBranchWeightMetadata(Module&, ProfileData&); virtual bool runOnModule(Module &M); @@ -92,21 +92,21 @@ ModulePass *llvm::createProfileMetadataLoaderPass(const std::string &Filename) { /// readEdge - Take the value from a profile counter and assign it to an edge. void ProfileMetadataLoaderPass::readEdge(unsigned ReadCount, ProfileData &PB, ProfileData::Edge e, - std::vector &Counters) { - if (ReadCount < Counters.size()) { - unsigned weight = Counters[ReadCount]; - assert(weight != ProfileDataLoader::Uncounted); - PB.addEdgeWeight(e, weight); - - DEBUG(dbgs() << "-- Read Edge Counter for " << e - << " (# "<< (ReadCount) << "): " - << PB.getEdgeWeight(e) << "\n"); - } + ArrayRef Counters) { + if (ReadCount >= Counters.size()) return; + + unsigned weight = Counters[ReadCount]; + assert(weight != ProfileDataLoader::Uncounted); + PB.addEdgeWeight(e, weight); + + DEBUG(dbgs() << "-- Read Edge Counter for " << e + << " (# "<< (ReadCount) << "): " + << PB.getEdgeWeight(e) << "\n"); } /// matchEdges - Link every profile counter with an edge. unsigned ProfileMetadataLoaderPass::matchEdges(Module &M, ProfileData &PB, - std::vector &Counters) { + ArrayRef Counters) { if (Counters.size() == 0) return 0; unsigned ReadCount = 0; @@ -147,7 +147,7 @@ void ProfileMetadataLoaderPass::setBranchWeightMetadata(Module &M, // Load the weights of all edges leading from this terminator. DEBUG(dbgs() << "-- Terminator with " << NumSuccessors << " successors:\n"); - std::vector Weights(NumSuccessors); + SmallVector Weights(NumSuccessors); for (unsigned s = 0 ; s < NumSuccessors ; ++s) { ProfileData::Edge edge = PB.getEdge(BB, TI->getSuccessor(s)); Weights[s] = (uint32_t)PB.getEdgeWeight(edge); @@ -172,7 +172,7 @@ bool ProfileMetadataLoaderPass::runOnModule(Module &M) { ProfileDataLoader PDL("profile-data-loader", Filename); ProfileData PB; - std::vector Counters = PDL.getRawEdgeCounts(); + ArrayRef Counters = PDL.getRawEdgeCounts(); unsigned ReadCount = matchEdges(M, PB, Counters); -- cgit v1.2.3