From: Luo Xionghu <[email protected]> considered two kernel function in one module, if the const variable generated by printf is used in the first kernel but changed to unused in the second kernel, the 1:1 map from constantSet to globallist will fail.
Signed-off-by: Luo Xionghu <[email protected]> --- backend/src/llvm/llvm_gen_backend.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index 980996e..3d76265 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2491,7 +2491,6 @@ namespace gbe { // Allocate a address register for each global variable const Module::GlobalListType &globalList = TheModule->getGlobalList(); - size_t j = 0; for(auto i = globalList.begin(); i != globalList.end(); i ++) { const GlobalVariable &v = *i; if(!v.isConstantUsed()) continue; @@ -2523,8 +2522,7 @@ namespace gbe GBE_ASSERT(v.hasInitializer()); this->newRegister(const_cast<GlobalVariable*>(&v)); ir::Register reg = regTranslator.getScalar(const_cast<GlobalVariable*>(&v), 0); - ir::Constant &con = unit.getConstantSet().getConstant(j ++); - GBE_ASSERT(con.getName() == v.getName()); + ir::Constant &con = unit.getConstantSet().getConstant(v.getName()); ctx.LOADI(ir::TYPE_S32, reg, ctx.newIntegerImmediate(con.getOffset(), ir::TYPE_S32)); } else { if(v.getName().equals(StringRef("__gen_ocl_printf_buf"))) { -- 1.9.1 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
