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

Joel E. Denny via flang-commits flang-commits at lists.llvm.org
Fri Jan 17 13:02:32 PST 2025


================
@@ -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);
----------------
jdenny-ornl wrote:

> C2 is the issue. Unlike `!fir_ptr<T>`, a `!fir_ref <!fir_ptr<T>>` is not a fortran `POINTER`.

I have been assuming that `!fir.ref<!fir.ptr<T>>` is the address of a pointer (that is, pointer non-data) but just missing the box.  Do you agree?

> I am aware of the discrepancy with fir.AddrOf

And dummy args.

> and as you can see there is a TODO there. I will be revisiting the whole `fir.load` approach to address it.

What do you have planned, and what's your timeline?

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


More information about the flang-commits mailing list