[mlir][Linalg] Fix ASAN bug

```
 LinalgTilingOptions &setTileSizes(ValueRange ts)
```
makes it all too easy to create stack-use-after-return errors.

In particular, c694588fc5 introduced one such issue.

Instead just take a copy in the lambda and be done with it.
This commit is contained in:
Nicolas Vasilache 2020-10-01 06:57:35 -04:00
parent 69acdfe075
commit a81b938b6d
1 changed files with 3 additions and 3 deletions

View File

@ -326,9 +326,9 @@ struct LinalgTilingOptions {
/// Set the `tileSizeComputationFunction` to return the values `ts`. The /// Set the `tileSizeComputationFunction` to return the values `ts`. The
/// values must not fold away when tiling. Otherwise, use a more robust /// values must not fold away when tiling. Otherwise, use a more robust
/// `tileSizeComputationFunction`. /// `tileSizeComputationFunction`.
LinalgTilingOptions &setTileSizes(ValueRange ts) { LinalgTilingOptions &setTileSizes(SmallVector<Value, 4> ts) {
tileSizeComputationFunction = [&](OpBuilder &, Operation *) { tileSizeComputationFunction = [=](OpBuilder &, Operation *) {
return SmallVector<Value, 4>(ts.begin(), ts.end()); return ts;
}; };
return *this; return *this;
} }