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

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Wed May 15 14:07:55 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
----------------
Renaud-K wrote:

git-clang-format is moving the llvm::dbgs statement next to the first one. But I can
`llvm::dbgs() << "\nAliasAnalysis::alias\n";`

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


More information about the flang-commits mailing list