Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 1 | //===- ProfileInfoLoaderPass.cpp - LLVM Pass to load profile info ---------===// |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 2 | // |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file implements a concrete implementation of profiling information that |
| 11 | // loads the information from a profile dump file. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 14 | #define DEBUG_TYPE "profile-loader" |
Chris Lattner | 96ab5ca | 2004-03-08 22:04:08 +0000 | [diff] [blame] | 15 | #include "llvm/BasicBlock.h" |
| 16 | #include "llvm/InstrTypes.h" |
Daniel Dunbar | ee16638 | 2009-08-05 15:55:56 +0000 | [diff] [blame] | 17 | #include "llvm/Module.h" |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 18 | #include "llvm/Pass.h" |
Jeff Cohen | 534927d | 2005-01-08 22:01:16 +0000 | [diff] [blame] | 19 | #include "llvm/Analysis/Passes.h" |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 20 | #include "llvm/Analysis/ProfileInfo.h" |
| 21 | #include "llvm/Analysis/ProfileInfoLoader.h" |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 22 | #include "llvm/Support/CommandLine.h" |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 23 | #include "llvm/Support/CFG.h" |
| 24 | #include "llvm/Support/Debug.h" |
Chris Lattner | a81d29b | 2009-08-23 07:33:14 +0000 | [diff] [blame] | 25 | #include "llvm/Support/raw_ostream.h" |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 26 | #include "llvm/Support/Format.h" |
| 27 | #include "llvm/ADT/Statistic.h" |
| 28 | #include "llvm/ADT/SmallSet.h" |
| 29 | #include <set> |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 30 | using namespace llvm; |
| 31 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 32 | STATISTIC(NumEdgesRead, "The # of edges read."); |
| 33 | |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 34 | static cl::opt<std::string> |
| 35 | ProfileInfoFilename("profile-info-file", cl::init("llvmprof.out"), |
| 36 | cl::value_desc("filename"), |
| 37 | cl::desc("Profile file loaded by -profile-loader")); |
Chris Lattner | 945871d | 2004-02-11 18:21:05 +0000 | [diff] [blame] | 38 | |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 39 | namespace { |
Nick Lewycky | 6726b6d | 2009-10-25 06:33:48 +0000 | [diff] [blame] | 40 | class LoaderPass : public ModulePass, public ProfileInfo { |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 41 | std::string Filename; |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 42 | std::set<Edge> SpanningTree; |
| 43 | std::set<const BasicBlock*> BBisUnvisited; |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 44 | unsigned ReadCount; |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 45 | public: |
Devang Patel | 1997473 | 2007-05-03 01:11:54 +0000 | [diff] [blame] | 46 | static char ID; // Class identification, replacement for typeinfo |
Dan Gohman | c2bbfc1 | 2007-08-01 15:32:29 +0000 | [diff] [blame] | 47 | explicit LoaderPass(const std::string &filename = "") |
Dan Gohman | ae73dc1 | 2008-09-04 17:05:41 +0000 | [diff] [blame] | 48 | : ModulePass(&ID), Filename(filename) { |
Chris Lattner | 945871d | 2004-02-11 18:21:05 +0000 | [diff] [blame] | 49 | if (filename.empty()) Filename = ProfileInfoFilename; |
| 50 | } |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 51 | |
| 52 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 53 | AU.setPreservesAll(); |
| 54 | } |
| 55 | |
| 56 | virtual const char *getPassName() const { |
| 57 | return "Profiling information loader"; |
| 58 | } |
| 59 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 60 | // recurseBasicBlock() - Calculates the edge weights for as much basic |
| 61 | // blocks as possbile. |
| 62 | virtual void recurseBasicBlock(const BasicBlock *BB); |
Edward O'Callaghan | 2afd072 | 2009-11-02 02:55:39 +0000 | [diff] [blame] | 63 | virtual void readEdgeOrRemember(Edge, Edge&, unsigned &, double &); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 64 | virtual void readEdge(ProfileInfo::Edge, std::vector<unsigned>&); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 65 | |
Chris Lattner | 1bc76d4 | 2010-01-20 20:09:02 +0000 | [diff] [blame] | 66 | /// getAdjustedAnalysisPointer - This method is used when a pass implements |
| 67 | /// an analysis interface through multiple inheritance. If needed, it |
| 68 | /// should override this to adjust the this pointer as needed for the |
| 69 | /// specified pass info. |
| 70 | virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { |
| 71 | if (PI->isPassID(&ProfileInfo::ID)) |
| 72 | return (ProfileInfo*)this; |
| 73 | return this; |
| 74 | } |
| 75 | |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 76 | /// run - Load the profile information from the specified file. |
Chris Lattner | b12914b | 2004-09-20 04:48:05 +0000 | [diff] [blame] | 77 | virtual bool runOnModule(Module &M); |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 78 | }; |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 79 | } // End of anonymous namespace |
| 80 | |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 81 | char LoaderPass::ID = 0; |
| 82 | static RegisterPass<LoaderPass> |
| 83 | X("profile-loader", "Load profile information from llvmprof.out", false, true); |
| 84 | |
| 85 | static RegisterAnalysisGroup<ProfileInfo> Y(X); |
| 86 | |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 87 | const PassInfo *llvm::ProfileLoaderPassID = &X; |
| 88 | |
Jeff Cohen | 6e400f7 | 2005-01-10 03:56:27 +0000 | [diff] [blame] | 89 | ModulePass *llvm::createProfileLoaderPass() { return new LoaderPass(); } |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 90 | |
| 91 | /// createProfileLoaderPass - This function returns a Pass that loads the |
| 92 | /// profiling information for the module from the specified filename, making it |
| 93 | /// available to the optimizers. |
| 94 | Pass *llvm::createProfileLoaderPass(const std::string &Filename) { |
| 95 | return new LoaderPass(Filename); |
| 96 | } |
| 97 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 98 | void LoaderPass::readEdgeOrRemember(Edge edge, Edge &tocalc, |
Edward O'Callaghan | 2afd072 | 2009-11-02 02:55:39 +0000 | [diff] [blame] | 99 | unsigned &uncalc, double &count) { |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 100 | double w; |
| 101 | if ((w = getEdgeWeight(edge)) == MissingValue) { |
| 102 | tocalc = edge; |
| 103 | uncalc++; |
| 104 | } else { |
| 105 | count+=w; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // recurseBasicBlock - Visits all neighbours of a block and then tries to |
| 110 | // calculate the missing edge values. |
| 111 | void LoaderPass::recurseBasicBlock(const BasicBlock *BB) { |
| 112 | |
| 113 | // break recursion if already visited |
| 114 | if (BBisUnvisited.find(BB) == BBisUnvisited.end()) return; |
| 115 | BBisUnvisited.erase(BB); |
| 116 | if (!BB) return; |
| 117 | |
| 118 | for (succ_const_iterator bbi = succ_begin(BB), bbe = succ_end(BB); |
| 119 | bbi != bbe; ++bbi) { |
| 120 | recurseBasicBlock(*bbi); |
| 121 | } |
Gabor Greif | 4442464 | 2010-03-25 23:25:28 +0000 | [diff] [blame] | 122 | for (const_pred_iterator bbi = pred_begin(BB), bbe = pred_end(BB); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 123 | bbi != bbe; ++bbi) { |
| 124 | recurseBasicBlock(*bbi); |
| 125 | } |
| 126 | |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 127 | Edge tocalc; |
| 128 | if (CalculateMissingEdge(BB, tocalc)) { |
| 129 | SpanningTree.erase(tocalc); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 130 | } |
| 131 | } |
| 132 | |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 133 | void LoaderPass::readEdge(ProfileInfo::Edge e, |
| 134 | std::vector<unsigned> &ECs) { |
| 135 | if (ReadCount < ECs.size()) { |
| 136 | double weight = ECs[ReadCount++]; |
Andreas Neustifter | 9233272 | 2009-09-16 11:35:50 +0000 | [diff] [blame] | 137 | if (weight != ProfileInfoLoader::Uncounted) { |
| 138 | // Here the data realm changes from the unsigned of the file to the |
| 139 | // double of the ProfileInfo. This conversion is save because we know |
| 140 | // that everything thats representable in unsinged is also representable |
| 141 | // in double. |
| 142 | EdgeInformation[getFunction(e)][e] += (double)weight; |
| 143 | |
David Greene | b511efa | 2009-12-23 21:58:29 +0000 | [diff] [blame] | 144 | DEBUG(dbgs() << "--Read Edge Counter for " << e |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 145 | << " (# "<< (ReadCount-1) << "): " |
| 146 | << (unsigned)getEdgeWeight(e) << "\n"); |
| 147 | } else { |
| 148 | // This happens only if reading optimal profiling information, not when |
| 149 | // reading regular profiling information. |
| 150 | SpanningTree.insert(e); |
| 151 | } |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 152 | } |
| 153 | } |
| 154 | |
Chris Lattner | b12914b | 2004-09-20 04:48:05 +0000 | [diff] [blame] | 155 | bool LoaderPass::runOnModule(Module &M) { |
Chris Lattner | 62e84f3 | 2004-03-08 21:30:35 +0000 | [diff] [blame] | 156 | ProfileInfoLoader PIL("profile-loader", Filename, M); |
Misha Brukman | 2b37d7c | 2005-04-21 21:13:18 +0000 | [diff] [blame] | 157 | |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 158 | EdgeInformation.clear(); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 159 | std::vector<unsigned> Counters = PIL.getRawEdgeCounts(); |
| 160 | if (Counters.size() > 0) { |
| 161 | ReadCount = 0; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 162 | for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
| 163 | if (F->isDeclaration()) continue; |
David Greene | b511efa | 2009-12-23 21:58:29 +0000 | [diff] [blame] | 164 | DEBUG(dbgs()<<"Working on "<<F->getNameStr()<<"\n"); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 165 | readEdge(getEdge(0,&F->getEntryBlock()), Counters); |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 166 | for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 167 | TerminatorInst *TI = BB->getTerminator(); |
| 168 | for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) { |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 169 | readEdge(getEdge(BB,TI->getSuccessor(s)), Counters); |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 170 | } |
Chris Lattner | 96ab5ca | 2004-03-08 22:04:08 +0000 | [diff] [blame] | 171 | } |
Chris Lattner | 96ab5ca | 2004-03-08 22:04:08 +0000 | [diff] [blame] | 172 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 173 | if (ReadCount != Counters.size()) { |
David Greene | fb64f11 | 2009-12-23 23:00:50 +0000 | [diff] [blame] | 174 | errs() << "WARNING: profile information is inconsistent with " |
Chris Lattner | a81d29b | 2009-08-23 07:33:14 +0000 | [diff] [blame] | 175 | << "the current program!\n"; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 176 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 177 | NumEdgesRead = ReadCount; |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 178 | } |
| 179 | |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 180 | Counters = PIL.getRawOptimalEdgeCounts(); |
| 181 | if (Counters.size() > 0) { |
| 182 | ReadCount = 0; |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 183 | for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
| 184 | if (F->isDeclaration()) continue; |
David Greene | b511efa | 2009-12-23 21:58:29 +0000 | [diff] [blame] | 185 | DEBUG(dbgs()<<"Working on "<<F->getNameStr()<<"\n"); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 186 | readEdge(getEdge(0,&F->getEntryBlock()), Counters); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 187 | for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |
| 188 | TerminatorInst *TI = BB->getTerminator(); |
| 189 | if (TI->getNumSuccessors() == 0) { |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 190 | readEdge(getEdge(BB,0), Counters); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 191 | } |
| 192 | for (unsigned s = 0, e = TI->getNumSuccessors(); s != e; ++s) { |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 193 | readEdge(getEdge(BB,TI->getSuccessor(s)), Counters); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 194 | } |
| 195 | } |
| 196 | while (SpanningTree.size() > 0) { |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 197 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 198 | unsigned size = SpanningTree.size(); |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 199 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 200 | BBisUnvisited.clear(); |
| 201 | for (std::set<Edge>::iterator ei = SpanningTree.begin(), |
| 202 | ee = SpanningTree.end(); ei != ee; ++ei) { |
| 203 | BBisUnvisited.insert(ei->first); |
| 204 | BBisUnvisited.insert(ei->second); |
| 205 | } |
| 206 | while (BBisUnvisited.size() > 0) { |
| 207 | recurseBasicBlock(*BBisUnvisited.begin()); |
| 208 | } |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 209 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 210 | if (SpanningTree.size() == size) { |
David Greene | b511efa | 2009-12-23 21:58:29 +0000 | [diff] [blame] | 211 | DEBUG(dbgs()<<"{"); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 212 | for (std::set<Edge>::iterator ei = SpanningTree.begin(), |
| 213 | ee = SpanningTree.end(); ei != ee; ++ei) { |
David Greene | b511efa | 2009-12-23 21:58:29 +0000 | [diff] [blame] | 214 | DEBUG(dbgs()<< *ei <<","); |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 215 | } |
| 216 | assert(0 && "No edge calculated!"); |
| 217 | } |
Andreas Neustifter | 44299c9 | 2009-12-03 11:00:37 +0000 | [diff] [blame] | 218 | |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 219 | } |
| 220 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 221 | if (ReadCount != Counters.size()) { |
David Greene | fb64f11 | 2009-12-23 23:00:50 +0000 | [diff] [blame] | 222 | errs() << "WARNING: profile information is inconsistent with " |
Andreas Neustifter | da5ea94 | 2009-09-01 19:08:51 +0000 | [diff] [blame] | 223 | << "the current program!\n"; |
| 224 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 225 | NumEdgesRead = ReadCount; |
Daniel Dunbar | c9008c5 | 2009-08-05 21:51:16 +0000 | [diff] [blame] | 226 | } |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 227 | |
| 228 | BlockInformation.clear(); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 229 | Counters = PIL.getRawBlockCounts(); |
| 230 | if (Counters.size() > 0) { |
| 231 | ReadCount = 0; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 232 | for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
| 233 | if (F->isDeclaration()) continue; |
| 234 | for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 235 | if (ReadCount < Counters.size()) |
Andreas Neustifter | 9233272 | 2009-09-16 11:35:50 +0000 | [diff] [blame] | 236 | // Here the data realm changes from the unsigned of the file to the |
| 237 | // double of the ProfileInfo. This conversion is save because we know |
| 238 | // that everything thats representable in unsinged is also |
| 239 | // representable in double. |
| 240 | BlockInformation[F][BB] = (double)Counters[ReadCount++]; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 241 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 242 | if (ReadCount != Counters.size()) { |
David Greene | fb64f11 | 2009-12-23 23:00:50 +0000 | [diff] [blame] | 243 | errs() << "WARNING: profile information is inconsistent with " |
Chris Lattner | a81d29b | 2009-08-23 07:33:14 +0000 | [diff] [blame] | 244 | << "the current program!\n"; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 245 | } |
| 246 | } |
| 247 | |
| 248 | FunctionInformation.clear(); |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 249 | Counters = PIL.getRawFunctionCounts(); |
| 250 | if (Counters.size() > 0) { |
| 251 | ReadCount = 0; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 252 | for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
| 253 | if (F->isDeclaration()) continue; |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 254 | if (ReadCount < Counters.size()) |
Andreas Neustifter | 9233272 | 2009-09-16 11:35:50 +0000 | [diff] [blame] | 255 | // Here the data realm changes from the unsigned of the file to the |
| 256 | // double of the ProfileInfo. This conversion is save because we know |
| 257 | // that everything thats representable in unsinged is also |
| 258 | // representable in double. |
| 259 | FunctionInformation[F] = (double)Counters[ReadCount++]; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 260 | } |
Andreas Neustifter | b4b1c9f | 2009-09-10 07:12:35 +0000 | [diff] [blame] | 261 | if (ReadCount != Counters.size()) { |
David Greene | fb64f11 | 2009-12-23 23:00:50 +0000 | [diff] [blame] | 262 | errs() << "WARNING: profile information is inconsistent with " |
Chris Lattner | a81d29b | 2009-08-23 07:33:14 +0000 | [diff] [blame] | 263 | << "the current program!\n"; |
Daniel Dunbar | caaa493 | 2009-08-08 17:43:09 +0000 | [diff] [blame] | 264 | } |
Chris Lattner | 945871d | 2004-02-11 18:21:05 +0000 | [diff] [blame] | 265 | } |
Chris Lattner | 96ab5ca | 2004-03-08 22:04:08 +0000 | [diff] [blame] | 266 | |
Chris Lattner | 927fec3 | 2004-02-11 06:10:05 +0000 | [diff] [blame] | 267 | return false; |
| 268 | } |