Skip to content

Commit 4474017

Browse files
committed
Adding source kind test
1 parent ce4bf77 commit 4474017

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -debug-only=fir-alias-analysis 2>&1 | FileCheck %s
2+
3+
// CHECK-LABEL: Testing : "_QFPtest"
4+
5+
// Checking that the source kind of a load of a load is SourceKind::Indirect
6+
// CHECK: {test.ptr = "load_load"}
7+
// CHECK-NEXT: SourceKind: Indirect
8+
9+
// Checking that the source kind of a load of an arg is SourceKind::Argument
10+
// CHECK: {test.ptr = "load_arg"}
11+
// CHECK-NEXT: SourceKind: Argument
12+
13+
func.func @_QFPtest(%arg0: !fir.ref<!fir.box<!fir.ptr<f32>>> ) attributes {test.ptr = "func"} {
14+
15+
%0 = fir.alloca !fir.llvm_ptr<!fir.box<!fir.ptr<f32>>>
16+
%1 = fir.convert %arg0 : (!fir.ref<!fir.box<!fir.ptr<f32>>>) -> !fir.llvm_ptr<!fir.box<!fir.ptr<f32>>>
17+
fir.store %1 to %0 : !fir.ref<!fir.llvm_ptr<!fir.box<!fir.ptr<f32>>>>
18+
%2 = fir.load %0 : !fir.ref<!fir.llvm_ptr<!fir.box<!fir.ptr<f32>>>>
19+
%3 = fir.convert %2 : (!fir.llvm_ptr<!fir.box<!fir.ptr<f32>>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
20+
%15 = fir.load %3 : !fir.ref<!fir.box<!fir.ptr<f32>>>
21+
%16 = fir.box_addr %15 {test.ptr = "load_load"} : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
22+
%17 = fir.load %arg0 : !fir.ref<!fir.box<!fir.ptr<f32>>>
23+
%18 = fir.box_addr %17 {test.ptr = "load_arg"} : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
24+
return
25+
}

0 commit comments

Comments
 (0)