diff --git a/tools/llvm-dis/Makefile b/tools/llvm-dis/Makefile index 6be8b096dbf..4b1088aec94 100644 --- a/tools/llvm-dis/Makefile +++ b/tools/llvm-dis/Makefile @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvm-dis -LINK_COMPONENTS := bcreader +LINK_COMPONENTS := bcreader bitreader REQUIRES_EH := 1 include $(LEVEL)/Makefile.common diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index 38b863c20c8..7a8bf5afc8d 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" +#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Bytecode/Reader.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Support/Compressor.h" @@ -52,9 +53,13 @@ int main(int argc, char **argv) { std::ostream *Out = &std::cout; // Default to printing to stdout. std::string ErrorMessage; - std::auto_ptr M(ParseBytecodeFile(InputFilename, - Compressor::decompressToNewBuffer, - &ErrorMessage)); + std::auto_ptr M; + + M.reset(ParseBitcodeFile(InputFilename, &ErrorMessage)); + + if (M.get() == 0) + M.reset(ParseBytecodeFile(InputFilename,Compressor::decompressToNewBuffer, + &ErrorMessage)); if (M.get() == 0) { cerr << argv[0] << ": "; if (ErrorMessage.size())