[Mlir-commits] [mlir] a81b938 - [mlir][Linalg] Fix ASAN bug

Nicolas Vasilache llvmlistbot at llvm.org
Thu Oct 1 04:04:31 PDT 2020


Author: Nicolas Vasilache
Date: 2020-10-01T06:57:35-04:00
New Revision: a81b938b6dee0e1ed4dd44e7d59325d0aa4774cc

URL: https://github.com/llvm/llvm-project/commit/a81b938b6dee0e1ed4dd44e7d59325d0aa4774cc
DIFF: https://github.com/llvm/llvm-project/commit/a81b938b6dee0e1ed4dd44e7d59325d0aa4774cc.diff

LOG: [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.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index a7f8c31e2264..e47dafc9bf52 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<Value, 4>(ts.begin(), ts.end());
+  LinalgTilingOptions &setTileSizes(SmallVector<Value, 4> ts) {
+    tileSizeComputationFunction = [=](OpBuilder &, Operation *) {
+      return ts;
     };
     return *this;
   }


        


More information about the Mlir-commits mailing list