LGTM, pushed.
> -----Original Message----- > From: Beignet [mailto:[email protected]] On Behalf Of > Ruiling Song > Sent: Wednesday, July 22, 2015 13:52 > To: [email protected] > Cc: Song, Ruiling > Subject: [Beignet] [PATCH] GBE: Fix a bug in assigning image bti. > > in llvm > 3.5, image address space was global, while in older version image > address space was private. So, I put an argument isImage when > getNewBTI() to make it also work correctly under llvm 3.3. > > Signed-off-by: Ruiling Song <[email protected]> > --- > backend/src/llvm/llvm_gen_backend.cpp | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/backend/src/llvm/llvm_gen_backend.cpp > b/backend/src/llvm/llvm_gen_backend.cpp > index 1e141cd..4905415 100644 > --- a/backend/src/llvm/llvm_gen_backend.cpp > +++ b/backend/src/llvm/llvm_gen_backend.cpp > @@ -583,7 +583,7 @@ namespace gbe > /*! For all possible pointers, GlobalVariable, function pointer argument, > alloca instruction, find their pointer escape points */ > void analyzePointerOrigin(Function &F); > - unsigned getNewBti(Value *origin); > + unsigned getNewBti(Value *origin, bool isImage); > void assignBti(Function &F); > bool isSingleBti(Value *Val); > Value *getBtiRegister(Value *v); > @@ -1098,8 +1098,14 @@ namespace gbe > } > } > > - unsigned GenWriter::getNewBti(Value *origin) { > + unsigned GenWriter::getNewBti(Value *origin, bool isImage) { > unsigned new_bti = 0; > + if (isImage) { > + new_bti = btiBase; > + incBtiBase(); > + return new_bti; > + } > + > if(origin->getName().equals(StringRef("__gen_ocl_printf_buf"))) { > new_bti = btiBase; > incBtiBase(); > @@ -1161,7 +1167,7 @@ namespace gbe > GlobalVariable &v = *i; > if(!v.isConstantUsed()) continue; > > - BtiMap.insert(std::make_pair(&v, getNewBti(&v))); > + BtiMap.insert(std::make_pair(&v, getNewBti(&v, false))); > } > MDNode *typeNameNode = NULL; > MDNode *node = getKernelFunctionMetadata(&F); @@ -1179,8 +1185,9 > @@ namespace gbe > ir::FunctionArgument::InfoFromLLVM llvmInfo; > for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; > ++I, > argID++) { > llvmInfo.typeName= (cast<MDString>(typeNameNode->getOperand(1 + > argID)))->getString(); > - if (I->getType()->isPointerTy() || llvmInfo.isImageType()) { > - BtiMap.insert(std::make_pair(I, getNewBti(I))); > + bool isImage = llvmInfo.isImageType(); > + if (I->getType()->isPointerTy() || isImage) { > + BtiMap.insert(std::make_pair(I, getNewBti(I, isImage))); > } > } > > -- > 2.3.6 > > _______________________________________________ > Beignet mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/beignet _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
