Skip to content

Commit 3347add

Browse files
committed
fix format; add test
1 parent 38d7efc commit 3347add

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4779,7 +4779,8 @@ class FirConverter : public Fortran::lower::AbstractConverter {
47794779
"Only one reference to the device resident object is supported");
47804780
auto addr = getSymbolAddress(sym);
47814781
mlir::Value baseValue;
4782-
if (auto declareOp = llvm::dyn_cast<hlfir::DeclareOp>(addr.getDefiningOp()))
4782+
if (auto declareOp =
4783+
llvm::dyn_cast<hlfir::DeclareOp>(addr.getDefiningOp()))
47834784
baseValue = declareOp.getBase();
47844785
else
47854786
baseValue = addr;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
! RUN: bbc -emit-hlfir -fcuda %s -o - | FileCheck %s
2+
3+
subroutine testr2(N1,N2)
4+
real(4), managed :: ai4(N1,N2)
5+
real(4), allocatable :: bRefi4(:)
6+
7+
integer :: i1, i2
8+
9+
do i2 = 1, N2
10+
do i1 = 1, N1
11+
ai4(i1,i2) = i1 + N1*(i2-1)
12+
enddo
13+
enddo
14+
15+
allocate(bRefi4 (N1))
16+
do i1 = 1, N1
17+
bRefi4(i1) = (ai4(i1,1)+ai4(i1,N2))*N2/2
18+
enddo
19+
deallocate(bRefi4)
20+
21+
end subroutine
22+
23+
!CHECK-LABEL: func.func @_QPtestr2
24+
!CHECK: %{{.*}} = cuf.alloc !fir.array<?x?xf32>, %{{.*}}, %{{.*}} : index, index {bindc_name = "ai4", data_attr = #cuf.cuda<managed>, uniq_name = "_QFtestr2Eai4"} -> !fir.ref<!fir.array<?x?xf32>>

0 commit comments

Comments
 (0)