[Beignet] [PATCH v2] Use CreateCall instead of CreateCall2.

Yang, Rong R rong.r.yang at intel.com
Thu Nov 19 18:51:04 PST 2015


LLVM3.5 fail is due to initializer list, LLVM3.5 ArrayRef don't have initializer list constructor.
You can use SmallVector, all LLVM ArrayRef has implicit SmallVector constructor. Like:

SmallVector<Value*, 4> callArgs;
callArgs.push_back(profilingBuf);
callArgs.push_back(ConstantInt::get(intTy, profilingType));
     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
             ptrTy,
             IntegerType::getInt32Ty(module->getContext()),
             NULL)),
        /* the args */{profilingBuf, ConstantInt::get(intTy, profilingType)});
        /* the args */callArgs);

> -----Original Message-----
> From: yan.wang at linux.intel.com [mailto:yan.wang at linux.intel.com]
> Sent: Thursday, November 19, 2015 16:43
> To: Yang, Rong R
> Cc: Yan Wang; beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH v2] Use CreateCall instead of CreateCall2.
> 
> So should we rollback to v1? It should be safe because it is only for LLVM
> >=3.7.
> Thanks.
> 
> Yan Wang
> 
> > Build fail in LLVM3.5.2.
> >
> >> -----Original Message-----
> >> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On
> >> Behalf Of Yan Wang
> >> Sent: Thursday, November 19, 2015 10:41
> >> To: beignet at lists.freedesktop.org
> >> Cc: Yan Wang
> >> Subject: [Beignet] [PATCH v2] Use CreateCall instead of CreateCall2.
> >>
> >> Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
> >> ---
> >>  backend/src/llvm/llvm_profiling.cpp | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/backend/src/llvm/llvm_profiling.cpp
> >> b/backend/src/llvm/llvm_profiling.cpp
> >> index 8c9157c..3fbd00d 100644
> >> --- a/backend/src/llvm/llvm_profiling.cpp
> >> +++ b/backend/src/llvm/llvm_profiling.cpp
> >> @@ -177,12 +177,12 @@ namespace gbe
> >>        builder->SetInsertPoint(instI);
> >>        /* Add the timestamp store function call. */
> >>        // __gen_ocl_store_timestamp(int nth, int type);
> >> -      builder->CreateCall2(cast<llvm::Function>(module-
> >> >getOrInsertFunction(
> >> +
> >> + builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunctio
> >> + builder->n(
> >>                "__gen_ocl_calc_timestamp", Type::getVoidTy(module-
> >> >getContext()),
> >>                IntegerType::getInt32Ty(module->getContext()),
> >>                IntegerType::getInt32Ty(module->getContext()),
> >>                NULL)),
> >> -          /* the args */ ConstantInt::get(intTy, pointNum++),
> >> ConstantInt::get(intTy, profilingType));
> >> +          /* the args */ {ConstantInt::get(intTy, pointNum++),
> >> + ConstantInt::get(intTy, profilingType)});
> >>      }
> >>      /* We insert one store_profiling at the end of the last block to
> >> hold the place. */
> >>      llvm::Function::iterator BE = F.end(); @@ -190,12 +190,12 @@
> >> namespace gbe
> >>      BasicBlock::iterator retInst = BE->end();
> >>      retInst--;
> >>      builder->SetInsertPoint(retInst);
> >> -
> >> builder->CreateCall2(cast<llvm::Function>(module->getOrInsertFunction
> >> builder->(
> >> +
> >> + builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunctio
> >> + builder->n(
> >>              "__gen_ocl_store_profiling",
> >> Type::getVoidTy(module->getContext()),
> >>              ptrTy,
> >>              IntegerType::getInt32Ty(module->getContext()),
> >>              NULL)),
> >> -        /* the args */profilingBuf, ConstantInt::get(intTy,
> >> profilingType));
> >> +        /* the args */{profilingBuf, ConstantInt::get(intTy,
> >> + profilingType)});
> >>
> >>      delete builder;
> >>      return changed;
> >> --
> >> 2.5.0
> >>
> >> _______________________________________________
> >> Beignet mailing list
> >> Beignet at lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/beignet
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> >



More information about the Beignet mailing list