[PATCH] D32961: [Polly][PPCGCodeGen] OpenCL now gets kernel argument size from PPCG CodeGen

Siddharth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 03:32:34 PDT 2017


bollu added inline comments.


================
Comment at: lib/CodeGen/PPCGCodeGeneration.cpp:1198
                                        SetVector<Value *> SubtreeValues) {
-  Type *ArrayTy = ArrayType::get(Builder.getInt8PtrTy(),
-                                 std::distance(F->arg_begin(), F->arg_end()));
+  int NumArgs = std::distance(F->arg_begin(), F->arg_end());
+  int *ArgSizes = new int[NumArgs];
----------------
PhilippSchaad wrote:
> bollu wrote:
> > bollu wrote:
> > > I believe `int NumArgs = F->getArgumentList().size()` will also work? seems a little clearer to me.
> > `NumArgs` could be `const`? It doesn't seem to be mutated anywhere.
> The type llvm::Function does not seem to have a member getArgumentList()? Also, I have just adapted that from before, but I agree that something like that would be clearer.
Hm, it looks like it has been removed. [I was looking at an older reference to `Function::getArgumentList`](http://llvm.org/docs/doxygen/html/classllvm_1_1Function.html#a0a46edcf9b885556850d8ed9c49d9b52). Apologies!

I believe that [`llvm::Function::arg_size()`](http://llvm.org/doxygen/classllvm_1_1Function.html#abccf59dbcc12707d079124e6bcfb4a47) should work for this purpose.


https://reviews.llvm.org/D32961





More information about the llvm-commits mailing list