diff options
| author | Nicolas Vasilache <ntv@google.com> | 2019-01-26 06:59:23 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 15:39:53 -0700 |
| commit | 81c7f2e2f3bf34bc45915bbb3eb44f37331aff91 (patch) | |
| tree | fa264aca53061508729c715b53c3714b363233d3 /mlir/lib/Transforms/ComposeAffineMaps.cpp | |
| parent | 75c21e1de01079cb65654d1c88007dba8772e6a1 (diff) | |
| download | bcm5719-llvm-81c7f2e2f3bf34bc45915bbb3eb44f37331aff91.tar.gz bcm5719-llvm-81c7f2e2f3bf34bc45915bbb3eb44f37331aff91.zip | |
Cleanup resource management and rename recursive matchers
This CL follows up on a memory leak issue related to SmallVector growth that
escapes the BumpPtrAllocator.
The fix is to properly use ArrayRef and placement new to define away the
issue.
The following renaming is also applied:
1. MLFunctionMatcher -> NestedPattern
2. MLFunctionMatches -> NestedMatch
As a consequence all allocations are now guaranteed to live on the BumpPtrAllocator.
PiperOrigin-RevId: 231047766
Diffstat (limited to 'mlir/lib/Transforms/ComposeAffineMaps.cpp')
| -rw-r--r-- | mlir/lib/Transforms/ComposeAffineMaps.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mlir/lib/Transforms/ComposeAffineMaps.cpp b/mlir/lib/Transforms/ComposeAffineMaps.cpp index 3dc81a0d793..4752928d062 100644 --- a/mlir/lib/Transforms/ComposeAffineMaps.cpp +++ b/mlir/lib/Transforms/ComposeAffineMaps.cpp @@ -22,7 +22,7 @@ //===----------------------------------------------------------------------===// #include "mlir/Analysis/AffineAnalysis.h" -#include "mlir/Analysis/MLFunctionMatcher.h" +#include "mlir/Analysis/NestedMatcher.h" #include "mlir/IR/AffineMap.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" @@ -49,7 +49,7 @@ struct ComposeAffineMaps : public FunctionPass { PassResult runOnFunction(Function *f) override; // Thread-safe RAII contexts local to pass, BumpPtrAllocator freed on exit. - MLFunctionMatcherContext MLContext; + NestedPatternContext MLContext; static char passID; }; @@ -74,8 +74,7 @@ PassResult ComposeAffineMaps::runOnFunction(Function *f) { auto apps = pattern.match(f); for (auto m : apps) { auto app = cast<OperationInst>(m.first)->cast<AffineApplyOp>(); - SmallVector<Value *, 8> operands(app->getOperands().begin(), - app->getOperands().end()); + SmallVector<Value *, 8> operands(app->getOperands()); FuncBuilder b(m.first); auto newApp = makeComposedAffineApply(&b, app->getLoc(), app->getAffineMap(), operands); |

