[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
Thu Feb 6 12:00:23 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:

> So T3 is the only test that would require this change.

I think you mean that C1+C2 relative to main will not affect T1, T2, and T4 but will affect T3 (MayAlias->NoAlias).  We still have to agree on whether that's an improvement.  Of course, this PR introduces many other tests that focus on this PR's original goal, and those are affected.

> We are going to take it separately. It will be running along with T4 after this PR: #126110. I have explained it to @jeanPerier and @vzakhari, and taken it apart will make for a much simpler discussion.

Sure, that's fine.  Will that discussion happen in one of the other PRs you are planning?

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


More information about the flang-commits mailing list