[flang-commits] [flang] [flang] Use fir.declare/fir.dummy_scope for TBAA tags attachments. (PR #92472)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Thu May 30 17:33:22 PDT 2024
================
@@ -30,8 +30,15 @@ using namespace mlir;
static bool isDummyArgument(mlir::Value v) {
auto blockArg{mlir::dyn_cast<mlir::BlockArgument>(v)};
- if (!blockArg)
+ if (!blockArg) {
+ auto defOp = v.getDefiningOp();
+ if (defOp) {
+ if (auto declareOp = mlir::dyn_cast<fir::DeclareOp>(defOp))
+ if (declareOp.getDummyScope())
+ return true;
----------------
vzakhari wrote:
Thanks for being patient with me, Tom!
Please note that `isDummyArgument` at [L374](https://github.com/llvm/llvm-project/pull/92472/files#diff-5d0a764398edd1ffe8b17f16f7be874b9178ca3a90f3a7457eec76d7403457f8L374) can only return `true` that it was not returning before my changes if `v` is ` fir.declare` with a `dummy_scope`. But that is impossible, because we recognize `fir.declare` as a pass-through operation, so if we meet `fir.declare` during the walk, `v` will be set to its memref that is not `fir.declare`. This is true when `getInstatiationPoint` is `false`, i.e. for the default/normal usage of FIR alias analysis.
When `getInstantiationPoint` is `true`, we set the `SourceKind::Argument` when we meet `fir.declare` with a `dummy_scope` and exit right away. I guess it does make sense for the users of the alias analysis to use `isDummyArgument` in this case, since the source type is already known. I just wanted to make sure `isDummyArgument` returns consistent information in this case.
Do you prefer removing the new code in `isDummyArgument`?
https://github.com/llvm/llvm-project/pull/92472
More information about the flang-commits
mailing list