From a81b938b6dee0e1ed4dd44e7d59325d0aa4774cc Mon Sep 17 00:00:00 2001 From: Nicolas Vasilache Date: Thu, 1 Oct 2020 06:57:35 -0400 Subject: [PATCH] [mlir][Linalg] Fix ASAN bug ``` LinalgTilingOptions &setTileSizes(ValueRange ts) ``` makes it all too easy to create stack-use-after-return errors. In particular, c694588fc52a8845174fee06ad0bcfa338e87816 introduced one such issue. Instead just take a copy in the lambda and be done with it. --- mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h index a7f8c31..e47dafc 100644 --- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h @@ -326,9 +326,9 @@ struct LinalgTilingOptions { /// Set the `tileSizeComputationFunction` to return the values `ts`. The /// values must not fold away when tiling. Otherwise, use a more robust /// `tileSizeComputationFunction`. - LinalgTilingOptions &setTileSizes(ValueRange ts) { - tileSizeComputationFunction = [&](OpBuilder &, Operation *) { - return SmallVector(ts.begin(), ts.end()); + LinalgTilingOptions &setTileSizes(SmallVector ts) { + tileSizeComputationFunction = [=](OpBuilder &, Operation *) { + return ts; }; return *this; } -- 2.7.4