Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mlir/lib/Dialect/Transform/Transforms/CheckUses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ class TransformOpMemFreeAnalysis {
void collectFreedValues(Operation *root) {
SmallVector<MemoryEffects::EffectInstance> instances;
root->walk([&](Operation *child) {
if (isa<transform::PatternDescriptorOpInterface>(child))
return;
// TODO: extend this to conservatively handle operations with undeclared
// side effects as maybe freeing the operands.
auto iface = cast<MemoryEffectOpInterface>(child);
Expand Down
14 changes: 14 additions & 0 deletions mlir/test/Dialect/Transform/check-use-after-free.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,17 @@ transform.sequence failures(propagate) {
^bb0(%arg1: !transform.any_op):
}
}

// -----

// This should not crash.

module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["func.func"]} in %arg0 : (!transform.any_op) -> !transform.any_op
transform.apply_patterns to %0 {
transform.apply_patterns.memref.extract_address_computations
} : !transform.any_op
transform.yield
}
}
Loading