[flang-commits] [flang] [flang] AliasAnalysis: More formally define and distinguish between data and non-data (PR #91020)

Joel E. Denny via flang-commits flang-commits at lists.llvm.org
Wed May 15 09:29:15 PDT 2024


================
@@ -0,0 +1,57 @@
+// RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' 2>&1 | FileCheck %s
+
+
+// module m
+// type t
+//  type(t), pointer :: next
+//  integer :: i
+// end type
+// contains
+// subroutine foo(x, y)
+//   type(t) :: x, y
+//   integer :: i1, i2
+//   i1 = x%next%i
+//   x = y
+//   i2 = x%next%i
+// end subroutine
+// end module
+
+// CHECK-LABEL: Testing : "_QMmPfoo"
+// TODO: x and y are non pointer, non target argument and therefore do not alias.
+// CHECK-DAG: x#0 <-> y#0: MayAlias
+
+// TODO: y is not a pointer object and therefore does not alias with the x%next component. 
+// CHECK-DAG: y#0 <-> xnext1#0: MayAlias
+// CHECK-DAG: y#0 <-> xnext2#0: MayAlias
+
+// Pointer components may alias with pointer objects, 
+// as well as other pointer components
----------------
jdenny-ornl wrote:

For this comment to be relevant, `x#0` must be considered either a pointer component or pointer object.  But `x#0` is like `y#0`, which the previous block says is not a pointer object and does not alias `xnext1#0` or `xnext2#0`.  Please clarify.

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


More information about the flang-commits mailing list