Skip to content

Commit 37b447b

Browse files
Renaud-KIcohedron
authored andcommitted
[flang] Adding a couple of tests to the alias analysis (llvm#125917)
To establish a baseline for new tests mentioned in llvm#117785, adding them here independently.
1 parent f5038da commit 37b447b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: flang/test/Analysis/AliasAnalysis/alias-analysis-2.fir

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
// CHECK-DAG: arg2.load#0 <-> arg2.addr#0: MustAlias
4848
// CHECK-DAG: boxp1.addr#0 <-> arg2.addr#0: MayAlias
4949

50+
// TODO: Can the address in a pointer alias the address of a pointer, even when the
51+
// pointer has no box. Should this be NoAlias?
52+
// T3: CHECK-DAG: p1.addr#0 <-> p1.tgt#0: MayAlias
53+
54+
// The addresses stored in two different pointers can alias, even if one has no
55+
// box. In this program, they happen to be the same address.
56+
// T4: CHECK-DAG: p1.tgt#0 <-> boxp1.addr#0: MayAlias
57+
5058
func.func @_QFPtest(%arg0: !fir.ref<f32> {fir.bindc_name = "v1", fir.target}, %arg1: !fir.ref<f32> {fir.bindc_name = "v2", fir.target}, %arg2: !fir.ref<!fir.box<!fir.ptr<f32>>> ) attributes {test.ptr = "func"} {
5159

5260
%1 = fir.alloca !fir.ptr<f32> {test.ptr = "p1.addr"}
@@ -63,7 +71,7 @@ func.func @_QFPtest(%arg0: !fir.ref<f32> {fir.bindc_name = "v1", fir.target}, %a
6371
fir.store %6 to %4 : !fir.ref<!fir.ptr<f32>>
6472

6573
%0 = fir.alloca !fir.box<!fir.ptr<f32>> {bindc_name = "p1", uniq_name = "_QFtestEp1"}
66-
%7 = fir.load %1 : !fir.ref<!fir.ptr<f32>>
74+
%7 = fir.load %1 {test.ptr="p1.tgt"} : !fir.ref<!fir.ptr<f32>>
6775
%8 = fir.embox %7 : (!fir.ptr<f32>) -> !fir.box<!fir.ptr<f32>>
6876
fir.store %8 to %0 : !fir.ref<!fir.box<!fir.ptr<f32>>>
6977

0 commit comments

Comments
 (0)