[flang-commits] [flang] [flang] AliasAnalysis: distinguish addr of arg vs. addr in arg (PR #87723)

Joel E. Denny via flang-commits flang-commits at lists.llvm.org
Thu Apr 25 13:47:33 PDT 2024


================
@@ -399,19 +404,30 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v) {
   if (!defOp && type == SourceKind::Unknown)
     // Check if the memory source is coming through a dummy argument.
     if (isDummyArgument(v)) {
-      type = SourceKind::Argument;
       ty = v.getType();
       if (fir::valueHasFirAttribute(v, fir::getTargetAttrName()))
         attributes.set(Attribute::Target);
-
       if (Source::isPointerReference(ty))
         attributes.set(Attribute::Pointer);
+      if (followBoxAddr && fir::isa_ref_type(ty))
----------------
jdenny-ornl wrote:

If I remove the `fir::isa_ref_type(ty)` check, several tests fail.  For example, in the function `test3` in `flang/test/Analysis/AliasAnalysis/alias-analysis-host-assoc.fir`, `y(1)` is analyzed as a `Direct` instead of an `Argument`.  It has type `!fir.box<!fir.array<?xi32>>` and is declared as `integer, target :: y(:)`.  Is that the information you're looking for?

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


More information about the flang-commits mailing list