[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:22 PST 2025


================
@@ -27,6 +27,29 @@ using namespace mlir;
 
 #define DEBUG_TYPE "fir-alias-analysis"
 
+static bool classifyAllocateFromEffects(mlir::Operation *op,
----------------
vzakhari wrote:

Please add a header comment.

I would also try to simplify the interface of this function (I am not a fan of returning results through references, if this can be avoided :) ).

I recommend getting rid of arguments `v`, `defOp` and `type`.  Instead of returning `bool` we can return either `SourceKind::Unknown` or `SourceKind::Allocate`. Then the callers can update their `v` and `defOp` values correspondingly if it returns `SourceKind::Allocate`.  I think the interface will become more clear.

https://github.com/llvm/llvm-project/pull/166806


More information about the flang-commits mailing list