[Beignet] [Patch v2 2/2] using name instead of index to query from ConstantSet.
xionghu.luo at intel.com
xionghu.luo at intel.com
Tue Oct 20 00:11:06 PDT 2015
From: Luo Xionghu <xionghu.luo at intel.com>
the GenPass' doInitialization is called before PrintfPass' runOnFunction,
so the collectGlobalConst is runned first, then the PrintfPass'runOnFunction
will remove the KERNEL function's unused global constant variable
but skipped the NON-KERNEL function, so the use of globallist will be
changed causing the mismatch with constantSet collected before.
v2: correct comments.
Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
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
More information about the Beignet
mailing list