[flang-commits] [flang] [flang] AliasAnalysis: Handle fir.load on fir.alloca (PR #117785)

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Tue Nov 26 18:09:34 PST 2024


================
@@ -522,6 +546,12 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
         .Case<fir::AllocaOp, fir::AllocMemOp>([&](auto op) {
           // Unique memory allocation.
           type = SourceKind::Allocate;
+          // If there's no DeclareOp, then we need to get the pointer attribute
+          // from the type.  TODO: That case occurs in our test suite
+          // (alias-analysis-2.fir), but does flang currently generate such
+          // code?
+          if (isPointerReference(ty))
+            attributes.set(Attribute::Pointer);
----------------
Renaud-K wrote:

Can you try remove the 2 changes you made for alias-analysis-2.fir, here and above and set the pointer attribute in
the case for fir::BoxAddrOp:

```
        .Case<fir::BoxAddrOp>([&](auto op) {
          v = op->getOperand(0);
          defOp = v.getDefiningOp();
          if (fir::isPointerType(v.getType()))
            attributes.set(Attribute::Pointer);
          if (mlir::isa<fir::BaseBoxType>(v.getType()))
            followBoxData = true;
        })
```

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


More information about the flang-commits mailing list