Skip to content

Commit

Permalink
Revert "[flang] Give internal linkage to internal procedures (llvm#81929
Browse files Browse the repository at this point in the history
)"

This reverts commit 06f775a.

It fixes flang-457354 test case.
  • Loading branch information
DominikAdamski committed Apr 22, 2024
1 parent 2a2be38 commit eefbfe4
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 140 deletions.
3 changes: 0 additions & 3 deletions flang/include/flang/Optimizer/Builder/FIRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,6 @@ fir::BoxValue createBoxValue(fir::FirOpBuilder &builder, mlir::Location loc,
/// Generate Null BoxProc for procedure pointer null initialization.
mlir::Value createNullBoxProc(fir::FirOpBuilder &builder, mlir::Location loc,
mlir::Type boxType);

/// Set internal linkage attribute on a function.
void setInternalLinkage(mlir::func::FuncOp);
} // namespace fir::factory

#endif // FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H
11 changes: 1 addition & 10 deletions flang/lib/Lower/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4656,16 +4656,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
assert(builder && "FirOpBuilder did not instantiate");
builder->setFastMathFlags(bridge.getLoweringOptions().getMathOptions());
builder->setInsertionPointToStart(&func.front());
if (funit.parent.isA<Fortran::lower::pft::FunctionLikeUnit>()) {
// Give internal linkage to internal functions. There are no name clash
// risks, but giving global linkage to internal procedure will break the
// static link register in shared libraries because of the system calls.
// Also, it should be possible to eliminate the procedure code if all the
// uses have been inlined.
fir::factory::setInternalLinkage(func);
} else {
func.setVisibility(mlir::SymbolTable::Visibility::Public);
}
func.setVisibility(mlir::SymbolTable::Visibility::Public);
assert(blockId == 0 && "invalid blockId");
assert(activeConstructStack.empty() && "invalid construct stack state");

Expand Down
8 changes: 0 additions & 8 deletions flang/lib/Optimizer/Builder/FIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FatalError.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "llvm/ADT/ArrayRef.h"
Expand Down Expand Up @@ -1589,10 +1588,3 @@ mlir::Value fir::factory::createNullBoxProc(fir::FirOpBuilder &builder,
mlir::Value initVal{builder.create<fir::ZeroOp>(loc, boxEleTy)};
return builder.create<fir::EmboxProcOp>(loc, boxTy, initVal);
}

void fir::factory::setInternalLinkage(mlir::func::FuncOp func) {
auto internalLinkage = mlir::LLVM::linkage::Linkage::Internal;
auto linkage =
mlir::LLVM::LinkageAttr::get(func->getContext(), internalLinkage);
func->setAttr("llvm.linkage", linkage);
}
5 changes: 4 additions & 1 deletion flang/lib/Optimizer/Builder/IntrinsicCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,10 @@ mlir::func::FuncOp IntrinsicLibrary::getWrapper(GeneratorType generator,
// First time this wrapper is needed, build it.
function = builder.createFunction(loc, wrapperName, funcType);
function->setAttr("fir.intrinsic", builder.getUnitAttr());
fir::factory::setInternalLinkage(function);
auto internalLinkage = mlir::LLVM::linkage::Linkage::Internal;
auto linkage =
mlir::LLVM::LinkageAttr::get(builder.getContext(), internalLinkage);
function->setAttr("llvm.linkage", linkage);
function.addEntryBlock();

// Create local context to emit code into the newly created function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ subroutine internal()
allocate(x)
end subroutine
end subroutine
! CHECK-LABEL: func.func private @_QFno_dealloc_host_assocPinternal
! CHECK-LABEL: func.func @_QFno_dealloc_host_assocPinternal
! CHECK-NOT: freemem
! CHECK-NOT: Deallocate
! CHECK: return
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/HLFIR/bindc_internal_proc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
! internal procedures.
! RUN: bbc -emit-hlfir %s -o - | FileCheck %s

!CHECK: func.func private @_QFsub1Pfoo(%{{.*}}: i32
!CHECK: func.func @_QFsub1Pfoo(%{{.*}}: i32
subroutine sub1()
call foo(42)
contains
Expand All @@ -13,7 +13,7 @@ subroutine foo(i) bind(c)
end subroutine
end subroutine

!CHECK: func.func private @_QFsub2Pfoo(%{{.*}}: i64
!CHECK: func.func @_QFsub2Pfoo(%{{.*}}: i64
subroutine sub2()
call foo(42_8)
contains
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/HLFIR/internal-procedures-2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subroutine internal_procedure(i, mask)
end forall
end subroutine
end subroutine
! CHECK-LABEL: func.func private @_QFhost_procedurePinternal_procedure(
! CHECK-LABEL: func.func @_QFhost_procedurePinternal_procedure(
! CHECK: fir.address_of(@_QMmodule_used_by_hostEindexed_by_var) : !fir.ref<!fir.array<2xi32>>
! CHECK: fir.address_of(@_QMmodule_used_by_hostEref_in_forall) : !fir.ref<!fir.array<2xi32>>
! CHECK: fir.address_of(@_QMmodule_used_by_hostEref_in_implied_do) : !fir.ref<i32>
12 changes: 6 additions & 6 deletions flang/test/Lower/HLFIR/internal-procedures.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ subroutine internal
call takes_array(x)
end subroutine
end subroutine
! CHECK-LABEL: func.func private @_QFtest_explicit_shape_arrayPinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.box<!fir.array<?xf32>>>> {fir.host_assoc}) attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! CHECK-LABEL: func.func @_QFtest_explicit_shape_arrayPinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.box<!fir.array<?xf32>>>> {fir.host_assoc}) attributes {fir.internal_proc} {
! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
! CHECK: %[[VAL_2:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_1]] : (!fir.ref<tuple<!fir.box<!fir.array<?xf32>>>>, i32) -> !fir.ref<!fir.box<!fir.array<?xf32>>>
! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_2]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
Expand All @@ -27,8 +27,8 @@ subroutine internal
call takes_array(x)
end subroutine
end subroutine
! CHECK-LABEL: func.func private @_QFtest_assumed_shapePinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.box<!fir.array<?xf32>>>> {fir.host_assoc}) attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! CHECK-LABEL: func.func @_QFtest_assumed_shapePinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.box<!fir.array<?xf32>>>> {fir.host_assoc}) attributes {fir.internal_proc} {
! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
! CHECK: %[[VAL_2:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_1]] : (!fir.ref<tuple<!fir.box<!fir.array<?xf32>>>>, i32) -> !fir.ref<!fir.box<!fir.array<?xf32>>>
! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_2]] : !fir.ref<!fir.box<!fir.array<?xf32>>>
Expand All @@ -44,8 +44,8 @@ subroutine internal()
call bar(c)
end subroutine
end subroutine
! CHECK-LABEL: func.func private @_QFtest_scalar_charPinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.boxchar<1>>> {fir.host_assoc}) attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! CHECK-LABEL: func.func @_QFtest_scalar_charPinternal(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.boxchar<1>>> {fir.host_assoc}) attributes {fir.internal_proc} {
! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
! CHECK: %[[VAL_2:.*]] = fir.coordinate_of %[[VAL_0]], %[[VAL_1]] : (!fir.ref<tuple<!fir.boxchar<1>>>, i32) -> !fir.ref<!fir.boxchar<1>>
! CHECK: %[[VAL_3:.*]] = fir.load %[[VAL_2]] : !fir.ref<!fir.boxchar<1>>
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/Intrinsics/random.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ subroutine random_test_2
call foo(size)
call bar(size, get)
contains
! CHECK-LABEL: func private @_QFrandom_test_2Pfoo
! CHECK-LABEL: func @_QFrandom_test_2Pfoo
subroutine foo(size, put, get)
! CHECK: [[s1:%[0-9]+]] = fir.is_present %arg0
! CHECK: [[s2:%[0-9]+]] = fir.embox %arg0
Expand All @@ -70,7 +70,7 @@ subroutine foo(size, put, get)
print*, size
end subroutine

! CHECK-LABEL: func private @_QFrandom_test_2Pbar
! CHECK-LABEL: func @_QFrandom_test_2Pbar
subroutine bar(size, get, put)
integer, optional :: size
! CHECK: [[p1:%[0-9]+]] = fir.is_present %arg2
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/Intrinsics/ubound01.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ subroutine s2(a,n,n2)
End Subroutine
end

! CHECK-LABEL: func.func private @_QFPs2
! CHECK-LABEL: func.func @_QFPs2
! CHECK-SAME: %[[ARG0:.*]]: !fir.box<!fir.array<?x?xf32>>
! CHECK: %[[BOX:.*]] = fir.rebox %[[ARG0]](%{{.*}}) : (!fir.box<!fir.array<?x?xf32>>, !fir.shift<2>) -> !fir.box<!fir.array<?x?xf32>>
! CHECK: %[[BOX_NONE:.*]] = fir.convert %[[BOX]] : (!fir.box<!fir.array<?x?xf32>>) -> !fir.box<none>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenACC/acc-routine04.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ subroutine sub2()
! CHECK: acc.routine @acc_routine_0 func(@_QMdummy_modPsub1) seq
! CHECK: func.func @_QMdummy_modPsub1(%arg0: !fir.ref<i32> {fir.bindc_name = "i"}) attributes {acc.routine_info = #acc.routine_info<[@acc_routine_0]>}
! CHECK: func.func @_QQmain() attributes {fir.bindc_name = "test_acc_routine"}
! CHECK: func.func private @_QFPsub2() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_1]>, llvm.linkage = #llvm.linkage<internal>}
! CHECK: func.func @_QFPsub2() attributes {acc.routine_info = #acc.routine_info<[@acc_routine_1]>}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module m
! CHECK: return
! CHECK: }
!
! CHECK-LABEL: func.func private @_QMm2FtestPinternal_test() {{.*}} {
! CHECK-LABEL: func.func @_QMm2FtestPinternal_test() {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref<i32>
! CHECK: %[[VAL_1:.*]] = omp.threadprivate %[[VAL_0]] : !fir.ref<i32> -> !fir.ref<i32>
! CHECK: fir.call @_QPbar(%[[VAL_1]]) {{.*}}: (!fir.ref<i32>) -> ()
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module m1
subroutine ss1
use m0
contains
!CHECK-LABEL: func private @_QMm1Fss1Pss2
!CHECK-LABEL: func @_QMm1Fss1Pss2
!CHECK: %[[CMN:.*]] = fir.address_of(@cmn_) : !fir.ref<!fir.array<4xi8>>
!CHECK: omp.parallel
!CHECK: %{{.*}} = omp.threadprivate %[[CMN]] : !fir.ref<!fir.array<4xi8>> -> !fir.ref<!fir.array<4xi8>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module m
! CHECK: return
! CHECK: }

! CHECK-LABEL: func.func private @_QMm2FtestPinternal_test() {{.*}} {
! CHECK-LABEL: func.func @_QMm2FtestPinternal_test() {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMmEx) : !fir.ref<i32>
! CHECK: %[[VAL_1:.*]]:2 = hlfir.declare %[[VAL_0]] {uniq_name = "_QMmEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
! CHECK: %[[VAL_2:.*]] = omp.threadprivate %[[VAL_1]]#1 : !fir.ref<i32> -> !fir.ref<i32>
Expand Down
10 changes: 5 additions & 5 deletions flang/test/Lower/PowerPC/ppc-vector-types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ program ppc_vec_unit
! CHECK-LLVM-NEXT: store <512 x i1> %[[RESQ]], ptr @_QFEvq2, align 64

contains
! CHECK-LLVM-LABEL: define internal <4 x i32> @_QFPtest_vec_integer_assign
! CHECK-LLVM-LABEL: define <4 x i32> @_QFPtest_vec_integer_assign
function test_vec_integer_assign(arg1)
! CHECK-LLVM: %[[FUNC_RES:.*]] = alloca <4 x i32>, i64 1, align 16
vector(integer(4)) :: arg1, test_vec_integer_assign
Expand All @@ -58,7 +58,7 @@ function test_vec_integer_assign(arg1)
! CHECK-LLVM-NEXT: ret <4 x i32> %[[RET]]
end function test_vec_integer_assign

! CHECK-LLVM-LABEL: define internal <2 x double> @_QFPtest_vec_real_assign
! CHECK-LLVM-LABEL: define <2 x double> @_QFPtest_vec_real_assign
function test_vec_real_assign(arg1)
! CHECK-LLVM: %[[FUNC_RES:.*]] = alloca <2 x double>, i64 1, align 16
vector(real(8)) :: arg1, test_vec_real_assign
Expand All @@ -72,7 +72,7 @@ function test_vec_real_assign(arg1)
! CHECK-LLVM-NEXT: ret <2 x double> %[[RET]]
end function test_vec_real_assign

! CHECK-LLVM-LABEL: define internal <8 x i16> @_QFPtest_vec_unsigned_assign
! CHECK-LLVM-LABEL: define <8 x i16> @_QFPtest_vec_unsigned_assign
function test_vec_unsigned_assign(arg1)
! CHECK-LLVM: %[[FUNC_RES:.*]] = alloca <8 x i16>, i64 1, align 16
vector(unsigned(2)) :: arg1, test_vec_unsigned_assign
Expand All @@ -86,7 +86,7 @@ function test_vec_unsigned_assign(arg1)
! CHECK-LLVM-NEXT: ret <8 x i16> %[[RET]]
end function test_vec_unsigned_assign

! CHECK-LLVM-LABEL: define internal <256 x i1> @_QFPtest_vec_pair_assign
! CHECK-LLVM-LABEL: define <256 x i1> @_QFPtest_vec_pair_assign
function test_vec_pair_assign(arg1)
! CHECK-LLVM: %[[FUNC_RES:.*]] = alloca <256 x i1>, i64 1, align 32
__vector_pair :: arg1, test_vec_pair_assign
Expand All @@ -100,7 +100,7 @@ function test_vec_pair_assign(arg1)
! CHECK-LLVM-NEXT: ret <256 x i1> %[[RET]]
end function test_vec_pair_assign

! CHECK-LLVM-LABEL: define internal <512 x i1> @_QFPtest_vec_quad_assign
! CHECK-LLVM-LABEL: define <512 x i1> @_QFPtest_vec_quad_assign
function test_vec_quad_assign(arg1)
! CHECK-LLVM: %[[FUNC_RES:.*]] = alloca <512 x i1>, i64 1, align 64
__vector_quad :: arg1, test_vec_quad_assign
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/array-temp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ subroutine tt1
! CHECK-NEXT: fir.call @_FortranAioEndIoStatement
print*, [(r([7.0]),i=1,3)]
contains
! CHECK-LABEL: func private @_QFtt1Pr
! CHECK-LABEL: func @_QFtt1Pr
function r(x)
real x(:)
r = x(1)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/dummy-arguments.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ program test1
call foo(10)
contains

! CHECK-LABEL: func private @_QFPfoo
! CHECK-LABEL: func @_QFPfoo
subroutine foo(avar1)
integer :: avar1
! integer :: my_data, my_data2
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/dummy-procedure-character.f90
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ subroutine host(f)
! CHECK: fir.call @_QFhostPintern(%[[VAL_1]])
call intern()
contains
! CHECK-LABEL: func private @_QFhostPintern(
! CHECK-LABEL: func @_QFhostPintern(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<tuple<!fir.boxproc<() -> ()>, i64>>> {fir.host_assoc})
subroutine intern()
! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
Expand Down Expand Up @@ -242,7 +242,7 @@ subroutine host2(f)
! CHECK: fir.call @_QFhost2Pintern(%[[VAL_1]])
call intern()
contains
! CHECK-LABEL: func private @_QFhost2Pintern(
! CHECK-LABEL: func @_QFhost2Pintern(
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<tuple<!fir.boxproc<() -> ()>, i64>>> {fir.host_assoc})
subroutine intern()
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<1,42> {bindc_name = ".result"}
Expand Down
16 changes: 8 additions & 8 deletions flang/test/Lower/equivalence-with-host-assoc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ subroutine inner
i1 = j1
end subroutine inner
end subroutine test1
! FIR-LABEL: func.func private @_QFtest1Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! FIR-LABEL: func.func @_QFtest1Pinner() attributes {fir.internal_proc} {
! FIR: %[[VAL_0:.*]] = fir.address_of(@_QFtest1Ei1) : !fir.ref<!fir.array<1xi32>>
! FIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<1xi32>>) -> !fir.ref<!fir.array<4xi8>>
! FIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand All @@ -24,7 +24,7 @@ end subroutine test1
! FIR: return
! FIR: }

! HLFIR-LABEL: func.func private @_QFtest1Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! HLFIR-LABEL: func.func @_QFtest1Pinner() attributes {fir.internal_proc} {
! HLFIR: %[[VAL_0:.*]] = fir.address_of(@_QFtest1Ei1) : !fir.ref<!fir.array<1xi32>>
! HLFIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<1xi32>>) -> !fir.ref<!fir.array<4xi8>>
! HLFIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand Down Expand Up @@ -54,7 +54,7 @@ subroutine inner
end subroutine inner
end subroutine host
end module test2
! FIR-LABEL: func.func private @_QMtest2FhostPinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! FIR-LABEL: func.func @_QMtest2FhostPinner() attributes {fir.internal_proc} {
! FIR: %[[VAL_0:.*]] = fir.address_of(@_QMtest2FhostEf1) : !fir.ref<!fir.array<1xi32>>
! FIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<1xi32>>) -> !fir.ref<!fir.array<4xi8>>
! FIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand All @@ -68,7 +68,7 @@ end module test2
! FIR: return
! FIR: }

! HLFIR-LABEL: func.func private @_QMtest2FhostPinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! HLFIR-LABEL: func.func @_QMtest2FhostPinner() attributes {fir.internal_proc} {
! HLFIR: %[[VAL_0:.*]] = fir.address_of(@_QMtest2FhostEf1) : !fir.ref<!fir.array<1xi32>>
! HLFIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<!fir.array<1xi32>>) -> !fir.ref<!fir.array<4xi8>>
! HLFIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand All @@ -94,7 +94,7 @@ subroutine inner
i1 = j1 + k1
end subroutine inner
end subroutine test3
! FIR-LABEL: func.func private @_QFtest3Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! FIR-LABEL: func.func @_QFtest3Pinner() attributes {fir.internal_proc} {
! FIR: %[[VAL_0:.*]] = fir.address_of(@blk_) : !fir.ref<tuple<i32>>
! FIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<tuple<i32>>) -> !fir.ref<!fir.array<?xi8>>
! FIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand All @@ -115,7 +115,7 @@ end subroutine test3
! FIR: return
! FIR: }

! HLFIR-LABEL: func.func private @_QFtest3Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! HLFIR-LABEL: func.func @_QFtest3Pinner() attributes {fir.internal_proc} {
! HLFIR: %[[VAL_0:.*]] = fir.address_of(@blk_) : !fir.ref<tuple<i32>>
! HLFIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<tuple<i32>>) -> !fir.ref<!fir.array<?xi8>>
! HLFIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand Down Expand Up @@ -149,7 +149,7 @@ subroutine inner
i1 = j1 + k1
end subroutine inner
end subroutine test4
! FIR-LABEL: func.func private @_QFtest4Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! FIR-LABEL: func.func @_QFtest4Pinner() attributes {fir.internal_proc} {
! FIR: %[[VAL_0:.*]] = fir.address_of(@blk_) : !fir.ref<tuple<i32>>
! FIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<tuple<i32>>) -> !fir.ref<!fir.array<?xi8>>
! FIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand All @@ -170,7 +170,7 @@ end subroutine test4
! FIR: return
! FIR: }

! HLFIR-LABEL: func.func private @_QFtest4Pinner() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! HLFIR-LABEL: func.func @_QFtest4Pinner() attributes {fir.internal_proc} {
! HLFIR: %[[VAL_0:.*]] = fir.address_of(@blk_) : !fir.ref<tuple<i32>>
! HLFIR: %[[VAL_1:.*]] = fir.convert %[[VAL_0]] : (!fir.ref<tuple<i32>>) -> !fir.ref<!fir.array<?xi8>>
! HLFIR: %[[VAL_2:.*]] = arith.constant 0 : index
Expand Down
12 changes: 6 additions & 6 deletions flang/test/Lower/explicit-interface-results-2.f90
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ subroutine host4()
integer :: n
call internal_proc_a()
contains
! CHECK-LABEL: func private @_QFhost4Pinternal_proc_a
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.ref<i32>>> {fir.host_assoc}) attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! CHECK-LABEL: func @_QFhost4Pinternal_proc_a
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<tuple<!fir.ref<i32>>> {fir.host_assoc}) attributes {fir.internal_proc} {
subroutine internal_proc_a()
call takes_array(return_array())
! CHECK: %[[VAL_1:.*]] = arith.constant 0 : i32
Expand All @@ -94,7 +94,7 @@ subroutine host5()
implicit none
call internal_proc_a()
contains
! CHECK-LABEL: func private @_QFhost5Pinternal_proc_a() attributes {fir.internal_proc, llvm.linkage = #llvm.linkage<internal>} {
! CHECK-LABEL: func @_QFhost5Pinternal_proc_a() attributes {fir.internal_proc} {
subroutine internal_proc_a()
call takes_array(return_array())
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMsome_moduleEn_module) : !fir.ref<i32>
Expand All @@ -115,7 +115,7 @@ subroutine host6()
implicit none
call internal_proc_a()
contains
! CHECK-LABEL: func private @_QFhost6Pinternal_proc_a
! CHECK-LABEL: func @_QFhost6Pinternal_proc_a
subroutine internal_proc_a()
call takes_array(return_array())
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QMsome_moduleEn_module) : !fir.ref<i32>
Expand Down Expand Up @@ -187,7 +187,7 @@ subroutine host9()
common /mycom/ n_common
call internal_proc_a()
contains
! CHECK-LABEL: func private @_QFhost9Pinternal_proc_a
! CHECK-LABEL: func @_QFhost9Pinternal_proc_a
subroutine internal_proc_a()
! CHECK: %[[VAL_0:.*]] = arith.constant 0 : index
! CHECK: %[[VAL_1:.*]] = fir.address_of(@mycom_) : !fir.ref<!fir.array<4xi8>>
Expand All @@ -213,7 +213,7 @@ subroutine host10()
implicit none
call internal_proc_a()
contains
! CHECK-LABEL: func private @_QFhost10Pinternal_proc_a
! CHECK-LABEL: func @_QFhost10Pinternal_proc_a
subroutine internal_proc_a()
call takes_array(return_array())
! CHECK: %[[VAL_0:.*]] = arith.constant 0 : index
Expand Down
Loading

0 comments on commit eefbfe4

Please sign in to comment.