summaryrefslogtreecommitdiff
path: root/backend/src/llvm/llvm_gen_backend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/src/llvm/llvm_gen_backend.cpp')
-rw-r--r--backend/src/llvm/llvm_gen_backend.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp
index 577564dc..c2c60a80 100644
--- a/backend/src/llvm/llvm_gen_backend.cpp
+++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -1702,7 +1702,21 @@ namespace gbe
GBE_ASSERT(con.getName() == v.getName());
ctx.LOADI(ir::TYPE_S32, reg, ctx.newIntegerImmediate(con.getOffset(), ir::TYPE_S32));
} else {
- GBE_ASSERT(0);
+ if(v.getName().str().substr(0, 4) == ".str") {
+ /* When there are multi printf statements in multi kernel fucntions within the same
+ translate unit, if they have the same sting parameter, such as
+ kernel_func1 () {
+ printf("Line is %d\n", line_num1);
+ }
+ kernel_func2 () {
+ printf("Line is %d\n", line_num2);
+ }
+ The Clang will just generate one global string named .strXXX to represent "Line is %d\n"
+ So when translating the kernel_func1, we can not unref that global var, so we will
+ get here. Just ignore it to avoid assert. */
+ } else {
+ GBE_ASSERT(0);
+ }
}
}