[flang-commits] [flang] [flang] Use fir.declare/fir.dummy_scope for TBAA tags attachments. (PR #92472)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed May 29 03:02:53 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;
----------------
tblah wrote:

I am worried about [L372](https://github.com/llvm/llvm-project/pull/92472/files#diff-5d0a764398edd1ffe8b17f16f7be874b9178ca3a90f3a7457eec76d7403457f8L372).

If for some reason we have an unknown source (e.g. due to a block argument or some unsupported operation), we will return that it is an argument if `isDummyArgument` returns true. That would then follow the logic I outlined above in `fir::AliasAnalysis::alias` leading to strong assumptions that it doesn't alias with other things in the same function.

Maybe `isDummyArgument` needs something like `getInstantiationPoint` to control whether inlined dummy arguments are treated as dummy arguments. Alternatively `fir::AliasAnalysis::alias` needs to understand dummy scopes.

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


More information about the flang-commits mailing list