Convert StringMap to using StringRef for its APIs.
[oota-llvm.git] / lib / Analysis / ProfileInfoLoader.cpp
index 732829887e91391587fcccd0c2e95861f3ab3f07..adb2bdc425491fae4fc5411233e635d64282cda3 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/InstrTypes.h"
 #include "llvm/Support/Streams.h"
 #include <cstdio>
+#include <cstdlib>
 #include <map>
 using namespace llvm;
 
@@ -72,7 +73,8 @@ static void ReadProfilingBlock(const char *ToolName, FILE *F,
 //
 ProfileInfoLoader::ProfileInfoLoader(const char *ToolName,
                                      const std::string &Filename,
-                                     Module &TheModule) : M(TheModule) {
+                                     Module &TheModule) : 
+                              M(TheModule), Warned(false) {
   FILE *F = fopen(Filename.c_str(), "r");
   if (F == 0) {
     cerr << ToolName << ": Error opening '" << Filename << "': ";
@@ -199,7 +201,6 @@ void ProfileInfoLoader::getBlockCounts(std::vector<std::pair<BasicBlock*,
         Counts.back().second += EdgeCounts[i].second;
         unsigned SuccNum = EdgeCounts[i].first.second;
         if (SuccNum >= TI->getNumSuccessors()) {
-          static bool Warned = false;
           if (!Warned) {
             cerr << "WARNING: profile info doesn't seem to match"
                  << " the program!\n";