add bitcode support


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36849 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 210f348..e5435ed 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -24,6 +24,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/Analysis/Verifier.h"
 #include "llvm/Bytecode/WriteBytecodePass.h"
+#include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/CommandLine.h"
@@ -38,6 +39,9 @@
 #include <fstream>
 using namespace llvm;
 
+static bool Bitcode = false;
+
+
 namespace {
   // ChildOutput - This option captures the name of the child output file that
   // is set up by the parent bugpoint process
@@ -110,7 +114,10 @@
 
   // Write bytecode out to disk as the last step...
   OStream L(OutFile);
-  PM.add(new WriteBytecodePass(&L));
+  if (Bitcode)
+    PM.add(CreateBitcodeWriterPass(OutFile));
+  else
+    PM.add(new WriteBytecodePass(&L));
 
   // Run all queued passes.
   PM.run(*Program);