llvm-project/mlir/lib/Analysis
Alex Zinenko 4affd0c40e [mlir] fix a memory leak in NestedPattern
NestedPattern uses a BumpPtrAllocator to store child (nested) pattern
objects to decrease the overhead of dynamic allocation. This assumes all
allocations happen inside the allocator that will be freed as a whole.
However, NestedPattern contains `std::function` as a member, which
allocates internally using `new`, unaware of the BumpPtrAllocator. Since
NestedPattern only holds pointers to the nested patterns allocated in
the BumpPtrAllocator, it never calls their destructors, so the
destructor of the `std::function`s they contain are never called either,
leaking the allocated memory.

Make NestedPattern explicitly call destructors of nested patterns. This
additionally requires to actually copy the nested patterns in
copy-construction and copy-assignment instead of just sharing the
pointer to the arena-allocated list of children to avoid double-free. An
alternative solution would be to add reference counting to the list of
arena-allocated list of children.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D98485
2021-03-12 18:52:14 +01:00
..
AliasAnalysis [mlir] Add initial support for an alias analysis framework in MLIR 2021-02-09 14:21:27 -08:00
Presburger [mlir] make MLIRPresburger depend on MLIRIR 2021-03-09 09:19:53 +01:00
AffineAnalysis.cpp Add `Operation* OpState::operator->()` to provide more convenient access to members of Operation. 2020-12-02 15:46:20 +01:00
AffineStructures.cpp [mlir][Affine] Add support for multi-store producer fusion 2021-01-25 20:31:17 +02:00
AliasAnalysis.cpp [mlir] Add initial support for an alias analysis framework in MLIR 2021-02-09 14:21:27 -08:00
BufferAliasAnalysis.cpp Add `Operation* OpState::operator->()` to provide more convenient access to members of Operation. 2020-12-02 15:46:20 +01:00
CMakeLists.txt [mlir] Add initial support for an alias analysis framework in MLIR 2021-02-09 14:21:27 -08:00
CallGraph.cpp [mlir] Update SCCP and the Inliner to use SymbolTableCollection for symbol lookups 2020-10-16 12:08:48 -07:00
LinearTransform.cpp [MLIR] Add support for extracting an integer sample point (if one exists) from an unbounded FlatAffineConstraints. 2021-01-22 22:28:38 +05:30
Liveness.cpp [mlir] Extend Operation visitor with pre-order traversal 2021-03-06 00:02:20 +02:00
LoopAnalysis.cpp [mlir][Affine] Fix vectorizability check for multiple load/stores 2020-12-09 12:19:34 -08:00
NestedMatcher.cpp [mlir] fix a memory leak in NestedPattern 2021-03-12 18:52:14 +01:00
NumberOfExecutions.cpp [mlir] Extend Operation visitor with pre-order traversal 2021-03-06 00:02:20 +02:00
PresburgerSet.cpp [MLIR] NFC: simplify PresburgerSet::isEqual 2021-01-18 22:47:25 +05:30
SliceAnalysis.cpp [mlir] Drop reliance of SliceAnalysis on specific ops. 2021-02-16 06:34:32 +00:00
Utils.cpp [mlir] Check 'iter_args' in 'isLoopParallel' utility 2021-02-25 18:12:34 +02:00