[flang-commits] [flang] [flang] Characterize allocation based on MemAlloc effect instead of pattern matching (PR #166806)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Thu Nov 6 16:01:21 PST 2025
================
@@ -285,6 +285,21 @@ llvm::LogicalResult fir::AllocaOp::verify() {
return mlir::success();
}
+void fir::AllocaOp::getEffects(
+ llvm::SmallVectorImpl<
+ mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect>>
+ &effects) {
+ // Value-scoped Allocate for AA.
+ effects.emplace_back(
+ mlir::MemoryEffects::Allocate::get(),
+ mlir::cast<mlir::OpResult>(getOperation()->getResult(0)),
+ mlir::SideEffects::AutomaticAllocationScopeResource::get());
+ // Preserve previous behavior: op-scoped Allocate for passes relying on it.
----------------
vzakhari wrote:
I think we do not need this here and for `AllocMemOp`. Did you find any LIT tests that fail without this?
I believe the effect above implies the effect that you are adding below. If it is not the case I am interested to see an example that fails.
https://github.com/llvm/llvm-project/pull/166806
More information about the flang-commits
mailing list