@@ -60,18 +60,18 @@ struct AliasAnalysis {
60
60
// module top
61
61
// real, pointer :: a(:)
62
62
// end module
63
- //
63
+ //
64
64
// subroutine test()
65
65
// use top
66
66
// a(1) = 1
67
67
// end subroutine
68
68
// -------------------------------------------------
69
- //
69
+ //
70
70
// flang -fc1 -emit-fir test.f90 -o test.fir
71
71
//
72
72
// ------------------- test.fir --------------------
73
- // fir.global @_QMtopEa : !fir.box<!fir.ptr<!fir.array<?xf32>>>
74
- //
73
+ // fir.global @_QMtopEa : !fir.box<!fir.ptr<!fir.array<?xf32>>>
74
+ //
75
75
// func.func @_QPtest() {
76
76
// %c1 = arith.constant 1 : index
77
77
// %cst = arith.constant 1.000000e+00 : f32
@@ -100,12 +100,12 @@ struct AliasAnalysis {
100
100
// Additionally, because it is relied on in HLFIR lowering, we allow querying
101
101
// on a box SSA value, which is interpreted as querying on its data.
102
102
//
103
- // So in the above example, !fir.ref<f32> and !fir.box<!fir.ptr<!fir.array<?xf32>>> is data,
103
+ // So in the above example, !fir.ref<f32> and !fir.box<!fir.ptr<!fir.array<?xf32>>> is data,
104
104
// while !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> is not data.
105
105
106
106
// This also applies to function arguments. In the example below, %arg0
107
107
// is data, %arg1 is not data but a load of %arg1 is.
108
- //
108
+ //
109
109
// func.func @_QFPtest2(%arg0: !fir.ref<f32>, %arg1: !fir.ref<!fir.box<!fir.ptr<f32>>> ) {
110
110
// %0 = fir.load %arg1 : !fir.ref<!fir.box<!fir.ptr<f32>>>
111
111
// ... }
@@ -183,6 +183,10 @@ struct AliasAnalysis {
183
183
friend llvm::raw_ostream &operator <<(llvm::raw_ostream &os,
184
184
const AliasAnalysis::Source &op);
185
185
186
+ // / Given the values and their sources, return their aliasing behavior.
187
+ mlir::AliasResult alias (Source lhsSrc, Source rhsSrc, mlir::Value lhs,
188
+ mlir::Value rhs);
189
+
186
190
// / Given two values, return their aliasing behavior.
187
191
mlir::AliasResult alias (mlir::Value lhs, mlir::Value rhs);
188
192
@@ -193,7 +197,8 @@ struct AliasAnalysis {
193
197
// / If getInstantiationPoint is true, the search for the source
194
198
// / will stop at [hl]fir.declare if it represents a dummy
195
199
// / argument declaration (i.e. it has the dummy_scope operand).
196
- Source getSource (mlir::Value, bool getInstantiationPoint = false );
200
+ fir::AliasAnalysis::Source getSource (mlir::Value,
201
+ bool getInstantiationPoint = false );
197
202
198
203
private:
199
204
// / Return true, if `ty` is a reference type to an object of derived type
0 commit comments