Initialize variable to null so it has a value in the off chance that a
[oota-llvm.git] / tools / llvm-prof / llvm-prof.cpp
index b0767e6fdf3066b85fa36f8d99a7b925825ef3ad..c85b0da1bc6cdb06618f2983934c2094547427d6 100644 (file)
 #include "llvm/Module.h"
 #include "llvm/Assembly/AsmAnnotationWriter.h"
 #include "llvm/Analysis/ProfileInfoLoader.h"
-#include "llvm/Bytecode/Reader.h"
+#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/System/Signals.h"
+#include <algorithm>
 #include <iostream>
 #include <iomanip>
 #include <map>
@@ -115,9 +117,12 @@ int main(int argc, char **argv) {
 
     // Read in the bytecode file...
     std::string ErrorMessage;
-    Module *M = ParseBytecodeFile(BytecodeFile, 
-                                  Compressor::decompressToNewBuffer, 
-                                  &ErrorMessage);
+    Module *M = 0;
+    if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BytecodeFile,
+                                                            &ErrorMessage)) {
+      M = ParseBitcodeFile(Buffer, &ErrorMessage);
+      delete Buffer;
+    }
     if (M == 0) {
       std::cerr << argv[0] << ": " << BytecodeFile << ": " 
         << ErrorMessage << "\n";