[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
Mon Feb 3 14:02:47 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:

After talking to @jeanPerier, you said `fir.alloca !fir.ptr<T>` needs to be supported, so we should avoid the potential behavior regression for it that T1 checks.  Also for `fir.alloca !fir.ptr<T>`, this PR with C3 alone will cause other behavior regressions, which T3 and T4 check.

It seems you have decided it will be fine to introduce only the latter behavior regressions when landing this PR and to fix them in a later PR.  To that end, I have adjusted this PR to have your C3 alone and to add fixme comments for T3 and T4.

For the sake of future development, would you please comment here on why it is reasonable to permit only the latter behavior regressions for now?

Thanks for your help.

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


More information about the flang-commits mailing list