[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
Tue May 28 11:15:29 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:

The usage of `isDummyArgument` at line [307](https://github.com/llvm/llvm-project/pull/92472/files#diff-5d0a764398edd1ffe8b17f16f7be874b9178ca3a90f3a7457eec76d7403457f8R307) allows propagating the source search past the indirection (the load).  My change does allow propagating past `fir.declare` (when `getInstantiationPoint` is `false`) in this case, but I cannot figure out an example where this would produce incorrect results in the end.

The `isDummyArgument` usage at the end of `getSource` should also not make a difference when `getInstantionPoint` is `false`, because we will just pass through any `fir.declare` we meet on the path.

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


More information about the flang-commits mailing list