From 758e152a4832311818ea5b2bff0ac2e438b7a88a Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 24 Oct 2017 09:45:53 -0700
Subject: [PATCH] Remove uses of LLVM dump() functions

These aren't exposed in release builds.
---
 llvmutil.cpp |  3 ++-
 opt.cpp      | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/llvmutil.cpp b/llvmutil.cpp
index 02bd729..b98b5f1 100644
--- a/llvmutil.cpp
+++ b/llvmutil.cpp
@@ -45,6 +45,7 @@
   #include <llvm/IR/Instructions.h>
   #include <llvm/IR/BasicBlock.h>
 #endif
+#include <llvm/Support/raw_os_ostream.h>
 #include <set>
 #include <map>
 
@@ -1516,7 +1517,7 @@ lDumpValue(llvm::Value *v, std::set<llvm::Value *> &done) {
         return;
 
     fprintf(stderr, "  ");
-    v->dump();
+    v->print(llvm::errs());
     done.insert(v);
 
     if (inst == NULL)
diff --git a/opt.cpp b/opt.cpp
index ef9e4c5..48106f4 100644
--- a/opt.cpp
+++ b/opt.cpp
@@ -169,7 +169,7 @@ static llvm::Pass *CreatePromoteLocalToPrivatePass();
                   strlen(getenv("FUNC"))))) {                           \
         fprintf(stderr, "Start of " NAME "\n");                \
         fprintf(stderr, "---------------\n");                  \
-        bb.dump();                                             \
+        bb.print(llvm::errs());                                \
         fprintf(stderr, "---------------\n\n");                \
     } else /* eat semicolon */
 
@@ -180,7 +180,7 @@ static llvm::Pass *CreatePromoteLocalToPrivatePass();
                   strlen(getenv("FUNC"))))) {                           \
         fprintf(stderr, "End of " NAME " %s\n", modifiedAny ? "** CHANGES **" : ""); \
         fprintf(stderr, "---------------\n");                  \
-        bb.dump();                                             \
+        bb.print(llvm::errs());                                \
         fprintf(stderr, "---------------\n\n");                \
     } else /* eat semicolon */
 
@@ -533,7 +533,7 @@ void
 Optimize(llvm::Module *module, int optLevel) {
     if (g->debugPrint) {
         printf("*** Code going into optimization ***\n");
-        module->dump();
+        module->print(llvm::errs(), nullptr);
     }
     DebugPassManager optPM;
     optPM.add(llvm::createVerifierPass(),0);
@@ -928,7 +928,7 @@ Optimize(llvm::Module *module, int optLevel) {
 
     if (g->debugPrint) {
         printf("\n*****\nFINAL OUTPUT\n*****\n");
-        module->dump();
+        module->print(llvm::errs(), nullptr);
     }
 
 }
@@ -4859,7 +4859,7 @@ bool
 DebugPass::runOnModule(llvm::Module &module) {
     fprintf(stderr, "%s", str_output);
     fflush(stderr);
-    module.dump();
+    module.print(llvm::errs(), nullptr);
     return true;
 }
 
-- 
1.8.3.1

