[Beignet] [PATCH] fix LLVM 3.5 fail.

xionghu.luo at intel.com xionghu.luo at intel.com
Thu Dec 10 00:33:54 PST 2015


From: Luo Xionghu <xionghu.luo at intel.com>

aslo call llvm::WriteBitcodeToFile for -dump-spir-binary option
under LLVM 3.5.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 backend/src/backend/program.cpp | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index daf6af0..14b802a 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -667,6 +667,20 @@ namespace gbe {
         (*out_module)->print(ostream, 0);
       } //Otherwise, you'll have to make do without the dump.
     }
+
+    if (!dumpSPIRBinaryName.empty()) {
+      std::string err;
+      llvm::raw_fd_ostream ostream (dumpSPIRBinaryName.c_str(),
+                                    err,
+      #if LLVM_VERSION_MINOR == 3
+                                    0
+      #else
+                                    llvm::sys::fs::F_None
+      #endif
+                                    );
+      if (err.empty())
+        llvm::WriteBitcodeToFile(*out_module, ostream);
+    }
 #else
     if (!dumpLLVMFileName.empty()) {
       std::error_code err;
-- 
1.9.1



More information about the Beignet mailing list