[Beignet] [PATCH] GBE: add check dumpASMFileName.empty()

Ruiling Song ruiling.song at intel.com
Sun Sep 6 00:11:58 PDT 2015


Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 backend/src/backend/program.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/backend/src/backend/program.cpp b/backend/src/backend/program.cpp
index d9e6416..e75e911 100644
--- a/backend/src/backend/program.cpp
+++ b/backend/src/backend/program.cpp
@@ -847,11 +847,14 @@ namespace gbe {
         clangErrSize = *errSize;
       }
 
-      FILE *asmDumpStream = fopen(dumpASMFileName.c_str(), "w");  
-      if (asmDumpStream)
-        fclose(asmDumpStream);
-      p = gbe_program_new_from_llvm(deviceID, NULL, out_module, llvm_ctx, dumpASMFileName.c_str(), stringSize,
-                                    err, errSize, optLevel);
+      if (!dumpASMFileName.empty()) {
+        FILE *asmDumpStream = fopen(dumpASMFileName.c_str(), "w");
+        if (asmDumpStream)
+          fclose(asmDumpStream);
+      }
+      p = gbe_program_new_from_llvm(deviceID, NULL, out_module, llvm_ctx,
+                                    dumpASMFileName.empty() ? NULL : dumpASMFileName.c_str(),
+                                    stringSize, err, errSize, optLevel);
       if (err != NULL)
         *errSize += clangErrSize;
       if (OCL_OUTPUT_BUILD_LOG && options)
-- 
2.3.1



More information about the Beignet mailing list