[flang-commits] [flang] [flang] Stop tracking memory source after a load in a more explicit manner. (PR #126156)

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Fri Feb 7 11:11:04 PST 2025


================
@@ -600,6 +590,40 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
             defOp = v.getDefiningOp();
             return;
           }
+
+          // If we are loading a box reference, but following the data,
+          // we gather the attributes of the box to populate the source
+          // and stop tracking.
+          if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(ty);
+              boxTy && followingData) {
----------------
Renaud-K wrote:

It does do that but it is not really the intention. The functionality should remain vastly the same, so maybe NFCI. Before and after the load of a `fir.alloca` will be a `SourceKind::Indirect`. If we are to extend data vs non-data, we will, it is just code. What is emerging from this change and the fact that everything still works with it, is a new idea for me:  it could make sense to have a `SourceKind::Emboxed` memory source in the future. But this is a topic for a different discussion.

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


More information about the flang-commits mailing list