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

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 03:40:40 PDT 2020


ftynse added inline comments.


================
Comment at: mlir/include/mlir/Conversion/StandardToLLVM/ConvertStandardToLLVM.h:385
+                           /*indexBitwidth=*/kDeriveIndexBitwidthFromDataLayout,
+                           /*useAlignedAlloc=*/false},
                        PatternBenefit benefit = 1);
----------------
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.


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