From 62e84f376b621eb848807e0652ad4bfc465ad1f5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 8 Mar 2004 21:30:35 +0000 Subject: [PATCH] Refactor implementations git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12240 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ProfileInfo.cpp | 4 +--- lib/Analysis/ProfileInfoLoaderPass.cpp | 9 ++------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp index 09bb1dfca13..a96dc4f2fc6 100644 --- a/lib/Analysis/ProfileInfo.cpp +++ b/lib/Analysis/ProfileInfo.cpp @@ -29,9 +29,7 @@ ProfileInfo::~ProfileInfo() {} // namespace { - struct NoProfileInfo : public ImmutablePass, public ProfileInfo { - unsigned getExecutionCount(BasicBlock *BB) { return 0; } - }; + struct NoProfileInfo : public ImmutablePass, public ProfileInfo {}; // Register this pass... RegisterOpt diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp index dab4b0e53c5..c1ff8cf5631 100644 --- a/lib/Analysis/ProfileInfoLoaderPass.cpp +++ b/lib/Analysis/ProfileInfoLoaderPass.cpp @@ -26,7 +26,6 @@ namespace { class LoaderPass : public Pass, public ProfileInfo { std::string Filename; - std::map ExecutionCounts; public: LoaderPass(const std::string &filename = "") : Filename(filename) { @@ -43,11 +42,6 @@ namespace { /// run - Load the profile information from the specified file. virtual bool run(Module &M); - - virtual unsigned getExecutionCount(BasicBlock *BB) { - std::map::iterator I = ExecutionCounts.find(BB); - return I != ExecutionCounts.end() ? I->second : 0; - } }; RegisterOpt @@ -65,7 +59,8 @@ Pass *llvm::createProfileLoaderPass(const std::string &Filename) { } bool LoaderPass::run(Module &M) { - ProfileInfoLoader PIL("opt", Filename, M); + ProfileInfoLoader PIL("profile-loader", Filename, M); + ExecutionCounts.clear(); if (PIL.hasAccurateBlockCounts()) { std::vector > Counts; PIL.getBlockCounts(Counts); -- 2.11.0