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

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Thu Feb 6 11:31:34 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);
----------------
Renaud-K wrote:

So T3 is the only test that would require this change. We are going to take it separately. It will be running along with T4 after this PR: https://github.com/llvm/llvm-project/pull/126110. I have explained it to @jeanPerier and @vzakhari, and  taken it apart will make for a much simpler discussion. 

I have 2 additional PRs that I would like to commit. One is https://github.com/llvm/llvm-project/pull/125925 and another one to come. They should be vastly no ops and mostly clean-ups that will help with your change. Mostly, I would like to take advantage that my head is fully into this code base now to take advantage of the time spent. They are changes that I have been meaning to do for awhile with @jeanPerier and @vzakhari as well and will address the TODO in `fir::AddrOfOp`





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


More information about the flang-commits mailing list