[PATCH] D80285: [mlir] make the bitwidth of device side index computations configurable

Tobias Gysi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 04:12:48 PDT 2020


gysit marked an inline comment as done.
gysit added inline comments.


================
Comment at: mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h:385
+                           /*indexBitwidth=*/kDeriveIndexBitwidthFromDataLayout,
+                           /*useAlignedAlloc=*/false},
                        PatternBenefit benefit = 1);
----------------
ftynse wrote:
> gysit wrote:
> > mehdi_amini wrote:
> > > I am puzzled how is this working?
> > > 
> > > This default value for this parameter is mapped to a reference member, how isn't it gonna lead to "use-after-free"?
> > > 
> > You are right this should not work (the lifetime of the default argument is limited to the body of the constructor -- I believe). I will submit a patch to fix this problem.
> Hmm, why wouldn't it? The lifetime of the temporary is that of the constructor body. The reference will be used to copy-construct the member struct at the beginning of the constructor implementation, at which point the temporary is guaranteed to be live. Then we will only use the member. It would have been a problem if ConvertToLLVMPattern kept a reference to the temporary.
>  It would have been a problem if ConvertToLLVMPattern kept a reference to the temporary.

The options member is unfortunately a const reference. 




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80285/new/

https://reviews.llvm.org/D80285





More information about the llvm-commits mailing list