Skip to content

[flang] Use BIND name, if any, when consolidating common blocks #65613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions flang/include/flang/Common/Fortran.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,7 @@ std::string AsFortran(IgnoreTKRSet);
bool AreCompatibleCUDADataAttrs(
std::optional<CUDADataAttr>, std::optional<CUDADataAttr>, IgnoreTKRSet);

static constexpr char blankCommonObjectName[] = "__BLNK__";

} // namespace Fortran::common
#endif // FORTRAN_COMMON_FORTRAN_H_
3 changes: 3 additions & 0 deletions flang/include/flang/Lower/LoweringOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ ENUM_LOWERINGOPT(LowerToHighLevelFIR, unsigned, 1, 0)
/// If true, reverse PowerPC native vector element order.
ENUM_LOWERINGOPT(NoPPCNativeVecElemOrder, unsigned, 1, 0)

/// If true, assume external names will be suffixed with an underscore. On by default.
ENUM_LOWERINGOPT(Underscoring, unsigned, 1, 1)

#undef LOWERINGOPT
#undef ENUM_LOWERINGOPT
6 changes: 4 additions & 2 deletions flang/include/flang/Lower/Mangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ using ScopeBlockIdMap =
/// a symbol where all the Fortran context is needed. Otherwise, external
/// symbols are mangled outside of any scope.
std::string mangleName(const semantics::Symbol &, ScopeBlockIdMap &,
bool keepExternalInScope = false);
bool keepExternalInScope = false,
bool underscoring = true);
std::string mangleName(const semantics::Symbol &,
bool keepExternalInScope = false);
bool keepExternalInScope = false,
bool underscoring = true);

/// Convert a derived type instance to an internal name.
std::string mangleName(const semantics::DerivedTypeSpec &, ScopeBlockIdMap &);
Expand Down
6 changes: 6 additions & 0 deletions flang/include/flang/Semantics/semantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class SemanticsContext {
}
const std::string &moduleDirectory() const { return moduleDirectory_; }
const std::string &moduleFileSuffix() const { return moduleFileSuffix_; }
bool underscoring() const { return underscoring_; }
bool warningsAreErrors() const { return warningsAreErrors_; }
bool debugModuleWriter() const { return debugModuleWriter_; }
const evaluate::IntrinsicProcTable &intrinsics() const { return intrinsics_; }
Expand Down Expand Up @@ -130,6 +131,10 @@ class SemanticsContext {
moduleFileSuffix_ = x;
return *this;
}
SemanticsContext &set_underscoring(bool x) {
underscoring_ = x;
return *this;
}
SemanticsContext &set_warnOnNonstandardUsage(bool x) {
warnOnNonstandardUsage_ = x;
return *this;
Expand Down Expand Up @@ -262,6 +267,7 @@ class SemanticsContext {
std::vector<std::string> intrinsicModuleDirectories_;
std::string moduleDirectory_{"."s};
std::string moduleFileSuffix_{".mod"};
bool underscoring_{true};
bool warnOnNonstandardUsage_{false};
bool warningsAreErrors_{false};
bool debugModuleWriter_{false};
Expand Down
3 changes: 3 additions & 0 deletions flang/include/flang/Semantics/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,5 +683,8 @@ std::optional<R> GetConstExpr(
// Returns "m" for a module, "m:sm" for a submodule.
std::string GetModuleOrSubmoduleName(const Symbol &);

// Return the assembly name emitted for a common block.
std::string GetCommonBlockObjectName(const Symbol &, bool underscoring);

} // namespace Fortran::semantics
#endif // FORTRAN_SEMANTICS_TOOLS_H_
4 changes: 3 additions & 1 deletion flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,8 @@ void CompilerInvocation::setSemanticsOpts(
.set_searchDirectories(fortranOptions.searchDirectories)
.set_intrinsicModuleDirectories(fortranOptions.intrinsicModuleDirectories)
.set_warningsAreErrors(getWarnAsErr())
.set_moduleFileSuffix(getModuleFileSuffix());
.set_moduleFileSuffix(getModuleFileSuffix())
.set_underscoring(getCodeGenOpts().Underscoring);

llvm::Triple targetTriple{llvm::Triple(this->targetOpts.triple)};
// FIXME: Handle real(3) ?
Expand All @@ -1262,6 +1263,7 @@ void CompilerInvocation::setLoweringOptions() {

// Lower TRANSPOSE as a runtime call under -O0.
loweringOpts.setOptimizeTranspose(codegenOpts.OptimizationLevel > 0);
loweringOpts.setUnderscoring(codegenOpts.Underscoring);

const LangOptions &langOptions = getLangOpts();
Fortran::common::MathOptionsBase &mathOpts = loweringOpts.getMathOptions();
Expand Down
4 changes: 3 additions & 1 deletion flang/lib/Lower/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
}
std::string
mangleName(const Fortran::semantics::Symbol &symbol) override final {
return Fortran::lower::mangle::mangleName(symbol, scopeBlockIdMap);
return Fortran::lower::mangle::mangleName(
symbol, scopeBlockIdMap, /*keepExternalInScope=*/false,
getLoweringOptions().getUnderscoring());
}
std::string mangleName(
const Fortran::semantics::DerivedTypeSpec &derivedType) override final {
Expand Down
17 changes: 9 additions & 8 deletions flang/lib/Lower/Mangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ Fortran::lower::mangle::mangleName(std::string &name,
}

// Mangle the name of \p symbol to make it globally unique.
std::string
Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
ScopeBlockIdMap &scopeBlockIdMap,
bool keepExternalInScope) {
std::string Fortran::lower::mangle::mangleName(
const Fortran::semantics::Symbol &symbol, ScopeBlockIdMap &scopeBlockIdMap,
bool keepExternalInScope, bool underscoring) {
// Resolve module and host associations before mangling.
const auto &ultimateSymbol = symbol.GetUltimate();

Expand Down Expand Up @@ -167,11 +166,12 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
symbolName);
},
[&](const Fortran::semantics::CommonBlockDetails &) {
return fir::NameUniquer::doCommonBlock(symbolName);
return Fortran::semantics::GetCommonBlockObjectName(ultimateSymbol,
underscoring);
},
[&](const Fortran::semantics::ProcBindingDetails &procBinding) {
return mangleName(procBinding.symbol(), scopeBlockIdMap,
keepExternalInScope);
keepExternalInScope, underscoring);
},
[&](const Fortran::semantics::DerivedTypeDetails &) -> std::string {
// Derived type mangling must use mangleName(DerivedTypeSpec) so
Expand All @@ -186,13 +186,14 @@ Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,

std::string
Fortran::lower::mangle::mangleName(const Fortran::semantics::Symbol &symbol,
bool keepExternalInScope) {
bool keepExternalInScope,
bool underscoring) {
assert((symbol.owner().kind() !=
Fortran::semantics::Scope::Kind::BlockConstruct ||
symbol.has<Fortran::semantics::SubprogramDetails>()) &&
"block object mangling must specify a scopeBlockIdMap");
ScopeBlockIdMap scopeBlockIdMap;
return mangleName(symbol, scopeBlockIdMap, keepExternalInScope);
return mangleName(symbol, scopeBlockIdMap, keepExternalInScope, underscoring);
}

std::string Fortran::lower::mangle::mangleName(
Expand Down
3 changes: 2 additions & 1 deletion flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "flang/Common/Fortran.h"
#include "flang/Optimizer/Dialect/FIRDialect.h"
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Support/InternalNames.h"
Expand Down Expand Up @@ -36,7 +37,7 @@ mangleExternalName(const std::pair<fir::NameUniquer::NameKind,
bool appendUnderscore) {
if (result.first == fir::NameUniquer::NameKind::COMMON &&
result.second.name.empty())
return "__BLNK__";
return Fortran::common::blankCommonObjectName;

if (appendUnderscore)
return result.second.name + "_";
Expand Down
12 changes: 10 additions & 2 deletions flang/lib/Semantics/semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,14 @@ class CommonBlockMap {
void MapCommonBlockAndCheckConflicts(
SemanticsContext &context, const Symbol &common) {
const Symbol *isInitialized{CommonBlockIsInitialized(common)};
auto [it, firstAppearance] = commonBlocks_.insert({common.name(),
// Merge common according to the name they will have in the object files.
// This allows merging BIND(C) and non BIND(C) common block instead of
// later crashing. This "merge" matches what ifort/gfortran/nvfortran are
// doing and what a linker would do if the definition were in distinct
// files.
std::string commonName{
GetCommonBlockObjectName(common, context.underscoring())};
auto [it, firstAppearance] = commonBlocks_.insert({commonName,
isInitialized ? CommonBlockInfo{common, common}
: CommonBlockInfo{common, std::nullopt}});
if (!firstAppearance) {
Expand Down Expand Up @@ -291,7 +298,8 @@ class CommonBlockMap {
}
return nullptr;
}
std::map<SourceName, CommonBlockInfo> commonBlocks_;

std::map<std::string, CommonBlockInfo> commonBlocks_;
};

SemanticsContext::SemanticsContext(
Expand Down
11 changes: 11 additions & 0 deletions flang/lib/Semantics/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1655,4 +1655,15 @@ std::string GetModuleOrSubmoduleName(const Symbol &symbol) {
return result;
}

std::string GetCommonBlockObjectName(const Symbol &common, bool underscoring) {
if (const std::string * bind{common.GetBindName()}) {
return *bind;
}
if (common.name().empty()) {
return Fortran::common::blankCommonObjectName;
}
return underscoring ? common.name().ToString() + "_"s
: common.name().ToString();
}

} // namespace Fortran::semantics
47 changes: 47 additions & 0 deletions flang/test/Lower/HLFIR/common-block-bindc-conflicts.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
! Test the mixing BIND(C) and non BIND(C) common blocks.

! RUN: %flang_fc1 -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=UNDERSCORING
! RUN: %flang_fc1 -emit-llvm -fno-underscoring %s -o - 2>&1 | FileCheck %s --check-prefix=NO-UNDERSCORING

! Scenario 1: Fortran symbols collide, but not the object file names, emit different
! globals for each common
subroutine bindc_common_with_same_fortran_name()
real :: x
common /com1/ x
bind(c, name="not_com1") :: /com1/
print *, x
end subroutine

subroutine bindc_common_with_same_fortran_name_2()
real :: x(2), y(2)
common /com1/ x
print *, x
end subroutine

! Scenario 2: object file names of common block may collide (depending on
! underscoring option). Merge common block into a single global symbol.
subroutine bindc_common_colliding_with_normal_common()
real :: x, y
common /com3/ x
common /com4/ y
bind(c, name="some_common_") :: /com3/
bind(c, name="__BLNK__") :: /com4/
print *, x, y
end subroutine
subroutine bindc_common_colliding_with_normal_common_2()
real :: x(2), y(2)
common /some_common/ x
common // y
print *, x, y
end subroutine

! UNDERSCORING: @__BLNK__ = common global [8 x i8] zeroinitializer
! UNDERSCORING: @com1_ = common global [8 x i8] zeroinitializer
! UNDERSCORING: @not_com1 = common global [4 x i8] zeroinitializer
! UNDERSCORING: @some_common_ = common global [8 x i8] zeroinitializer

! NO-UNDERSCORING: @__BLNK__ = common global [8 x i8] zeroinitializer
! NO-UNDERSCORING: @com1 = common global [8 x i8] zeroinitializer
! NO-UNDERSCORING: @not_com1 = common global [4 x i8] zeroinitializer
! NO-UNDERSCORING: @some_common = common global [8 x i8] zeroinitializer
! NO-UNDERSCORING: @some_common_ = common global [4 x i8] zeroinitializer
4 changes: 2 additions & 2 deletions flang/test/Lower/OpenMP/copyin.f90
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ subroutine combined_parallel_sections()


!CHECK: func.func @_QPcommon_1() {
!CHECK: %[[val_0:.*]] = fir.address_of(@_QCc) : !fir.ref<!fir.array<4xi8>>
!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<4xi8>>
!CHECK: %[[val_1:.*]] = omp.threadprivate %[[val_0]] : !fir.ref<!fir.array<4xi8>> -> !fir.ref<!fir.array<4xi8>>
!CHECK: %[[val_2:.*]] = fir.convert %[[val_1]] : (!fir.ref<!fir.array<4xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
Expand Down Expand Up @@ -258,7 +258,7 @@ subroutine common_1()

!CHECK: func.func @_QPcommon_2() {
!CHECK: %[[val_0:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFcommon_2Ei"}
!CHECK: %[[val_1:.*]] = fir.address_of(@_QCd) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_1:.*]] = fir.address_of(@d_) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_2:.*]] = omp.threadprivate %[[val_1]] : !fir.ref<!fir.array<8xi8>> -> !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
Expand Down
6 changes: 3 additions & 3 deletions flang/test/Lower/OpenMP/declare-target-data.f90
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ module test_0
end module test_0

PROGRAM commons
!CHECK-DAG: fir.global @_QCnumbers {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
!CHECK-DAG: fir.global @numbers_ {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
REAL :: one = 1
REAL :: two = 2
COMMON /numbers/ one, two
!$omp declare target(/numbers/)

!CHECK-DAG: fir.global @_QCnumbers_link {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : tuple<f32, f32> {
!CHECK-DAG: fir.global @numbers_link_ {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (link)>} : tuple<f32, f32> {
REAL :: one_link = 1
REAL :: two_link = 2
COMMON /numbers_link/ one_link, two_link
!$omp declare target link(/numbers_link/)

!CHECK-DAG: fir.global @_QCnumbers_to {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
!CHECK-DAG: fir.global @numbers_to_ {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : tuple<f32, f32> {
REAL :: one_to = 1
REAL :: two_to = 2
COMMON /numbers_to/ one_to, two_to
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/firstprivate-commonblock.f90
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! RUN: %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s

!CHECK: func.func @_QPfirstprivate_common() {
!CHECK: %[[val_0:.*]] = fir.address_of(@_QCc) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_0:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_1:.*]] = fir.convert %[[val_0]] : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c0]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/lastprivate-commonblock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!CHECK: func.func @_QPlastprivate_common() {
!CHECK: %[[val_0:.*]] = fir.alloca i32 {adapt.valuebyref, pinned}
!CHECK: %[[val_1:.*]] = fir.alloca i32 {bindc_name = "i", uniq_name = "_QFlastprivate_commonEi"}
!CHECK: %[[val_2:.*]] = fir.address_of(@_QCc) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_2:.*]] = fir.address_of(@c_) : !fir.ref<!fir.array<8xi8>>
!CHECK: %[[val_3:.*]] = fir.convert %[[val_2]] : (!fir.ref<!fir.array<8xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
!CHECK: %[[val_4:.*]] = fir.coordinate_of %[[val_3]], %[[val_c0]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/OpenMP/private-commonblock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subroutine private_common
!$omp end parallel
end subroutine

!CHECK: %[[val_0:.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<74xi8>>
!CHECK: %[[val_0:.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<74xi8>>
!CHECK: %[[val_1:.*]] = fir.convert %0 : (!fir.ref<!fir.array<74xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c0:.*]] = arith.constant 0 : index
!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c0]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
Expand Down Expand Up @@ -72,7 +72,7 @@ subroutine private_clause_commonblock()
end subroutine

!CHECK: func.func @_QPprivate_clause_commonblock_pointer() {
!CHECK: %[[val_0:.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<74xi8>>
!CHECK: %[[val_0:.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<74xi8>>
!CHECK: %[[val_1:.*]] = fir.convert %[[val_0]] : (!fir.ref<!fir.array<74xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK: %[[val_c24:.*]] = arith.constant 24 : index
!CHECK: %[[val_2:.*]] = fir.coordinate_of %[[val_1]], %[[val_c24]] : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
!RUN: bbc -hlfir -emit-hlfir -fopenmp %s -o - | FileCheck %s


!CHECK: %[[CBLK_ADDR:.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<4xi8>>
!CHECK: %[[CBLK_ADDR:.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<4xi8>>
!CHECK: {{.*}} = omp.threadprivate %[[CBLK_ADDR]] : !fir.ref<!fir.array<4xi8>> -> !fir.ref<!fir.array<4xi8>>
!CHECK: omp.parallel {
!CHECK: %[[TP_PARALLEL:.*]] = omp.threadprivate %[[CBLK_ADDR]] : !fir.ref<!fir.array<4xi8>> -> !fir.ref<!fir.array<4xi8>>
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Lower/OpenMP/threadprivate-commonblock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ module test

!$omp threadprivate(/blk/)

!CHECK: fir.global common @_QCblk(dense<0> : vector<103xi8>) : !fir.array<103xi8>
!CHECK: fir.global common @blk_(dense<0> : vector<103xi8>) : !fir.array<103xi8>

contains
subroutine sub()
!CHECK: [[ADDR0:%.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<103xi8>>
!CHECK: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<103xi8>>
!CHECK: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref<!fir.array<103xi8>> -> !fir.ref<!fir.array<103xi8>>
!CHECK-DAG: [[ADDR1:%.*]] = fir.convert [[NEWADDR0]] : (!fir.ref<!fir.array<103xi8>>) -> !fir.ref<!fir.array<?xi8>>
!CHECK-DAG: [[C0:%.*]] = arith.constant 0 : index
Expand Down
8 changes: 4 additions & 4 deletions flang/test/Lower/OpenMP/threadprivate-use-association.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

!RUN: %flang_fc1 -emit-fir -fopenmp %s -o - | FileCheck %s

!CHECK-DAG: fir.global common @_QCblk(dense<0> : vector<24xi8>) : !fir.array<24xi8>
!CHECK-DAG: fir.global common @blk_(dense<0> : vector<24xi8>) : !fir.array<24xi8>
!CHECK-DAG: fir.global @_QMtestEy : f32 {

module test
Expand All @@ -16,7 +16,7 @@ module test
contains
subroutine sub()
! CHECK-LABEL: @_QMtestPsub
!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref<!fir.array<24xi8>> -> !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref<f32>
!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref<f32> -> !fir.ref<f32>
Expand Down Expand Up @@ -49,9 +49,9 @@ program main
call sub()

! CHECK-LABEL: @_QQmain()
!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR0:%.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[NEWADDR0:%.*]] = omp.threadprivate [[ADDR0]] : !fir.ref<!fir.array<24xi8>> -> !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@_QCblk) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR1:%.*]] = fir.address_of(@blk_) : !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[NEWADDR1:%.*]] = omp.threadprivate [[ADDR1]] : !fir.ref<!fir.array<24xi8>> -> !fir.ref<!fir.array<24xi8>>
!CHECK-DAG: [[ADDR2:%.*]] = fir.address_of(@_QMtestEy) : !fir.ref<f32>
!CHECK-DAG: [[NEWADDR2:%.*]] = omp.threadprivate [[ADDR2]] : !fir.ref<f32> -> !fir.ref<f32>
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/array.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! RUN: bbc -o - %s | FileCheck %s

! CHECK-LABEL: fir.global @_QCblock
! CHECK-LABEL: fir.global @block_
! CHECK-DAG: %[[VAL_1:.*]] = arith.constant 1.000000e+00 : f32
! CHECK-DAG: %[[VAL_2:.*]] = arith.constant 2.400000e+00 : f32
! CHECK-DAG: %[[VAL_3:.*]] = arith.constant 0.000000e+00 : f32
Expand Down
Loading