summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/src/llvm/llvm_printf_parser.cpp3
-rw-r--r--backend/src/llvm/llvm_to_gen.cpp1
-rw-r--r--src/cl_command_queue.c2
3 files changed, 4 insertions, 2 deletions
diff --git a/backend/src/llvm/llvm_printf_parser.cpp b/backend/src/llvm/llvm_printf_parser.cpp
index 74b57ab0..384d36f8 100644
--- a/backend/src/llvm/llvm_printf_parser.cpp
+++ b/backend/src/llvm/llvm_printf_parser.cpp
@@ -543,12 +543,13 @@ error:
module = F.getParent();
intTy = IntegerType::get(module->getContext(), 32);
- builder = new IRBuilder<>(module->getContext());
// As we inline all function calls, so skip non-kernel functions
bool bKernel = isKernelFunction(F);
if(!bKernel) return false;
+ builder = new IRBuilder<>(module->getContext());
+
/* Iter the function and find printf. */
for (llvm::Function::iterator B = F.begin(), BE = F.end(); B != BE; B++) {
for (BasicBlock::iterator instI = B->begin(),
diff --git a/backend/src/llvm/llvm_to_gen.cpp b/backend/src/llvm/llvm_to_gen.cpp
index 153b11db..758ea482 100644
--- a/backend/src/llvm/llvm_to_gen.cpp
+++ b/backend/src/llvm/llvm_to_gen.cpp
@@ -243,7 +243,6 @@ namespace gbe
passes.add(createPrintModulePass(&*o));
#endif
passes.run(mod);
-
return true;
}
} /* namespace gbe */
diff --git a/src/cl_command_queue.c b/src/cl_command_queue.c
index d45e92f1..842c8649 100644
--- a/src/cl_command_queue.c
+++ b/src/cl_command_queue.c
@@ -446,7 +446,9 @@ cl_command_queue_flush_gpgpu(cl_command_queue queue, cl_gpgpu gpgpu)
cl_gpgpu_unmap_printf_buffer(gpgpu, 0);
if (interp_get_printf_sizeof_size(printf_info))
cl_gpgpu_unmap_printf_buffer(gpgpu, 1);
+ }
+ if (printf_info) {
interp_release_printf_info(printf_info);
global_wk_sz[0] = global_wk_sz[1] = global_wk_sz[2] = 0;
cl_gpgpu_set_printf_info(gpgpu, NULL, global_wk_sz);