llvm-project/flang/test/Lower/variable-inquiries.f90
Valentin Clement 99d239341c
[flang][NFC] Add lowering tests
Add couple of tests for the lowering.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D121991

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2022-03-18 14:48:56 +01:00

22 lines
918 B
Fortran

! Test property inquiries on variables
! RUN: bbc -emit-fir %s -o - | FileCheck %s
module inquired
real(8), allocatable :: a(:)
end module
! CHECK-LABEL: @_QPissue844()
subroutine issue844()
use inquired
! Verify that evaluate::DescriptorInquiry are made using the symbol mapped
! in lowering (the use associated one, and not directly the ultimate
! symbol).
! CHECK: %[[a:.*]] = fir.address_of(@_QMinquiredEa) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>
! CHECK: %[[box_load:.*]] = fir.load %[[a]] : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf64>>>>
! CHECK: %[[dim:.*]]:3 = fir.box_dims %[[box_load]], %c0{{.*}} : (!fir.box<!fir.heap<!fir.array<?xf64>>>, index) -> (index, index, index)
! CHECK: %[[cast:.*]] = fir.convert %[[dim]]#1 : (index) -> i64
! CHECK: fir.call @_FortranAioOutputInteger64(%{{.*}}, %[[cast]]) : (!fir.ref<i8>, i64) -> i1
print *, size(a, kind=8)
end subroutine