diff --git a/flang/include/flang/ISO_Fortran_binding.h b/flang/include/flang/ISO_Fortran_binding.h index 757d7f2b10cb..85401f50b684 100644 --- a/flang/include/flang/ISO_Fortran_binding.h +++ b/flang/include/flang/ISO_Fortran_binding.h @@ -30,7 +30,7 @@ #endif /* 18.5.4 */ -#define CFI_VERSION 20180515 +#define CFI_VERSION 20240719 #define CFI_MAX_RANK 15 typedef unsigned char CFI_rank_t; @@ -146,7 +146,9 @@ extern "C++" template struct FlexibleArray : T { CFI_rank_t rank; /* [0 .. CFI_MAX_RANK] */ \ CFI_type_t type; \ CFI_attribute_t attribute; \ - unsigned char f18Addendum; + /* This encodes both the presence of the f18Addendum and the index of the \ + * allocator used to managed memory of the data hold by the descriptor. */ \ + unsigned char extra; typedef struct CFI_cdesc_t { _CFI_CDESC_T_HEADER_MEMBERS diff --git a/flang/include/flang/Optimizer/CodeGen/TBAABuilder.h b/flang/include/flang/Optimizer/CodeGen/TBAABuilder.h index 5420e48146bb..8032fb8fe3d5 100644 --- a/flang/include/flang/Optimizer/CodeGen/TBAABuilder.h +++ b/flang/include/flang/Optimizer/CodeGen/TBAABuilder.h @@ -55,7 +55,7 @@ namespace fir { // <@type_desc_3, 20>, // rank // <@type_desc_3, 21>, // type // <@type_desc_3, 22>, // attribute -// <@type_desc_3, 23>} // f18Addendum +// <@type_desc_3, 23>} // extra // } // llvm.tbaa_type_desc @type_desc_5 { // id = "CFI_cdesc_t_dim1", @@ -65,7 +65,7 @@ namespace fir { // <@type_desc_3, 20>, // rank // <@type_desc_3, 21>, // type // <@type_desc_3, 22>, // attribute -// <@type_desc_3, 23>, // f18Addendum +// <@type_desc_3, 23>, // extra // <@type_desc_3, 24>, // dim[0].lower_bound // <@type_desc_3, 32>, // dim[0].extent // <@type_desc_3, 40>} // dim[0].sm @@ -78,7 +78,7 @@ namespace fir { // <@type_desc_3, 20>, // rank // <@type_desc_3, 21>, // type // <@type_desc_3, 22>, // attribute -// <@type_desc_3, 23>, // f18Addendum +// <@type_desc_3, 23>, // extra // <@type_desc_3, 24>, // dim[0].lower_bound // <@type_desc_3, 32>, // dim[0].extent // <@type_desc_3, 40>, // dim[0].sm diff --git a/flang/include/flang/Optimizer/CodeGen/TypeConverter.h b/flang/include/flang/Optimizer/CodeGen/TypeConverter.h index ece3e4e073f6..7215abf3a8f8 100644 --- a/flang/include/flang/Optimizer/CodeGen/TypeConverter.h +++ b/flang/include/flang/Optimizer/CodeGen/TypeConverter.h @@ -29,7 +29,7 @@ static constexpr unsigned kVersionPosInBox = 2; static constexpr unsigned kRankPosInBox = 3; static constexpr unsigned kTypePosInBox = 4; static constexpr unsigned kAttributePosInBox = 5; -static constexpr unsigned kF18AddendumPosInBox = 6; +static constexpr unsigned kExtraPosInBox = 6; static constexpr unsigned kDimsPosInBox = 7; static constexpr unsigned kOptTypePtrPosInBox = 8; static constexpr unsigned kOptRowTypePosInBox = 9; diff --git a/flang/include/flang/Runtime/descriptor.h b/flang/include/flang/Runtime/descriptor.h index 1b0b7e23ce6c..043f6931afad 100644 --- a/flang/include/flang/Runtime/descriptor.h +++ b/flang/include/flang/Runtime/descriptor.h @@ -92,8 +92,8 @@ private: // The storage for this object follows the last used dim[] entry in a // Descriptor (CFI_cdesc_t) generic descriptor. Space matters here, since // descriptors serve as POINTER and ALLOCATABLE components of derived type -// instances. The presence of this structure is implied by the flag -// CFI_cdesc_t.f18Addendum, and the number of elements in the len_[] +// instances. The presence of this structure is encoded in the +// CFI_cdesc_t.extra field, and the number of elements in the len_[] // array is determined by derivedType_->LenParameters(). class DescriptorAddendum { public: @@ -339,14 +339,14 @@ public: const SubscriptValue *, const int *permutation = nullptr) const; RT_API_ATTRS DescriptorAddendum *Addendum() { - if (raw_.f18Addendum != 0) { + if (HasAddendum()) { return reinterpret_cast(&GetDimension(rank())); } else { return nullptr; } } RT_API_ATTRS const DescriptorAddendum *Addendum() const { - if (raw_.f18Addendum != 0) { + if (HasAddendum()) { return reinterpret_cast( &GetDimension(rank())); } else { @@ -420,6 +420,27 @@ public: void Dump(FILE * = stdout) const; +// Value of the addendum presence flag. +#define _CFI_ADDENDUM_FLAG 1 +// Number of bits needed to be shifted when manipulating the allocator index. +#define _CFI_ALLOCATOR_IDX_SHIFT 1 +// Allocator index mask. +#define _CFI_ALLOCATOR_IDX_MASK 0b00001110 + + RT_API_ATTRS inline bool HasAddendum() const { + return raw_.extra & _CFI_ADDENDUM_FLAG; + } + RT_API_ATTRS inline void SetHasAddendum() { + raw_.extra |= _CFI_ADDENDUM_FLAG; + } + RT_API_ATTRS inline int GetAllocIdx() const { + return (raw_.extra & _CFI_ALLOCATOR_IDX_MASK) >> _CFI_ALLOCATOR_IDX_SHIFT; + } + RT_API_ATTRS inline void SetAllocIdx(int pos) { + raw_.extra &= ~_CFI_ALLOCATOR_IDX_MASK; // Clear the allocator index bits. + raw_.extra |= (pos << _CFI_ALLOCATOR_IDX_SHIFT); + } + private: ISO::CFI_cdesc_t raw_; }; diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index 99f1453f1314..4a98585c34c7 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -1241,9 +1241,10 @@ struct EmboxCommonConversion : public fir::FIROpConversion { descriptor = insertField(rewriter, loc, descriptor, {kAttributePosInBox}, this->genI32Constant(loc, rewriter, getCFIAttr(boxTy))); + const bool hasAddendum = fir::boxHasAddendum(boxTy); descriptor = - insertField(rewriter, loc, descriptor, {kF18AddendumPosInBox}, + insertField(rewriter, loc, descriptor, {kExtraPosInBox}, this->genI32Constant(loc, rewriter, hasAddendum ? 1 : 0)); if (hasAddendum) { diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp index 59f67f4fcad4..1043494b6fb4 100644 --- a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp +++ b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp @@ -177,7 +177,7 @@ bool LLVMTypeConverter::requiresExtendedDesc(mlir::Type boxElementType) const { // the addendum defined in descriptor.h. mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box, int rank) const { - // (base_addr*, elem_len, version, rank, type, attribute, f18Addendum, [dim] + // (base_addr*, elem_len, version, rank, type, attribute, extra, [dim] llvm::SmallVector dataDescFields; mlir::Type ele = box.getEleTy(); // remove fir.heap/fir.ref/fir.ptr @@ -206,9 +206,9 @@ mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box, // attribute dataDescFields.push_back( getDescFieldTypeModel()(&getContext())); - // f18Addendum + // extra dataDescFields.push_back( - getDescFieldTypeModel()(&getContext())); + getDescFieldTypeModel()(&getContext())); // [dims] if (rank == unknownRank()) { if (auto seqTy = mlir::dyn_cast(ele)) diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index d587fd44b167..1f3ae23dcbf1 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -107,6 +107,7 @@ add_subdirectory(Float128Math) set(sources ISO_Fortran_binding.cpp + allocator-registry.cpp allocatable.cpp array-constructor.cpp assign.cpp @@ -178,6 +179,7 @@ include(AddFlangOffloadRuntime) set(supported_files ISO_Fortran_binding.cpp allocatable.cpp + allocator-registry.cpp array-constructor.cpp assign.cpp buffer.cpp diff --git a/flang/runtime/ISO_Fortran_util.h b/flang/runtime/ISO_Fortran_util.h index 469067600bd9..dd0eeef80bb8 100644 --- a/flang/runtime/ISO_Fortran_util.h +++ b/flang/runtime/ISO_Fortran_util.h @@ -86,7 +86,7 @@ static inline RT_API_ATTRS void EstablishDescriptor(CFI_cdesc_t *descriptor, descriptor->rank = rank; descriptor->type = type; descriptor->attribute = attribute; - descriptor->f18Addendum = 0; + descriptor->extra = 0; std::size_t byteSize{elem_len}; constexpr std::size_t lower_bound{0}; if (base_addr) { diff --git a/flang/runtime/allocator-registry.cpp b/flang/runtime/allocator-registry.cpp new file mode 100644 index 000000000000..461756d2ba95 --- /dev/null +++ b/flang/runtime/allocator-registry.cpp @@ -0,0 +1,42 @@ +//===-- runtime/allocator-registry.cpp ------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "allocator-registry.h" +#include "terminator.h" + +namespace Fortran::runtime { + +#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS +RT_OFFLOAD_VAR_GROUP_BEGIN +RT_VAR_ATTRS AllocatorRegistry allocatorRegistry; +RT_OFFLOAD_VAR_GROUP_END +#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS + +RT_OFFLOAD_API_GROUP_BEGIN +RT_API_ATTRS void AllocatorRegistry::Register(int pos, Allocator_t allocator) { + // pos 0 is reserved for the default allocator and is registered in the + // struct ctor. + INTERNAL_CHECK(pos > 0 && pos < MAX_ALLOCATOR); + allocators[pos] = allocator; +} + +RT_API_ATTRS AllocFct AllocatorRegistry::GetAllocator(int pos) { + INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR); + AllocFct f{allocators[pos].alloc}; + INTERNAL_CHECK(f != nullptr); + return f; +} + +RT_API_ATTRS FreeFct AllocatorRegistry::GetDeallocator(int pos) { + INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR); + FreeFct f{allocators[pos].free}; + INTERNAL_CHECK(f != nullptr); + return f; +} +RT_OFFLOAD_API_GROUP_END +} // namespace Fortran::runtime diff --git a/flang/runtime/allocator-registry.h b/flang/runtime/allocator-registry.h new file mode 100644 index 000000000000..3243e1deab63 --- /dev/null +++ b/flang/runtime/allocator-registry.h @@ -0,0 +1,55 @@ +//===-- runtime/allocator-registry.h ----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef FORTRAN_RUNTIME_ALLOCATOR_H_ +#define FORTRAN_RUNTIME_ALLOCATOR_H_ + +#include "flang/Common/api-attrs.h" +#include +#include + +#define MAX_ALLOCATOR 5 + +namespace Fortran::runtime { + +using AllocFct = void *(*)(std::size_t); +using FreeFct = void (*)(void *); + +typedef struct Allocator_t { + AllocFct alloc{nullptr}; + FreeFct free{nullptr}; +} Allocator_t; + +#ifdef RT_DEVICE_COMPILATION +static RT_API_ATTRS void *MallocWrapper(std::size_t size) { + return std::malloc(size); +} +static RT_API_ATTRS void FreeWrapper(void *p) { return std::free(p); } +#endif + +struct AllocatorRegistry { +#ifdef RT_DEVICE_COMPILATION + RT_API_ATTRS constexpr AllocatorRegistry() + : allocators{{&MallocWrapper, &FreeWrapper}} {} +#else + constexpr AllocatorRegistry() { allocators[0] = {&std::malloc, &std::free}; }; +#endif + RT_API_ATTRS void Register(int, Allocator_t); + RT_API_ATTRS AllocFct GetAllocator(int pos); + RT_API_ATTRS FreeFct GetDeallocator(int pos); + + Allocator_t allocators[MAX_ALLOCATOR]; +}; + +RT_OFFLOAD_VAR_GROUP_BEGIN +extern RT_VAR_ATTRS AllocatorRegistry allocatorRegistry; +RT_OFFLOAD_VAR_GROUP_END + +} // namespace Fortran::runtime + +#endif // FORTRAN_RUNTIME_ALLOCATOR_H_ diff --git a/flang/runtime/descriptor.cpp b/flang/runtime/descriptor.cpp index 9b04cb4f8d0d..d71b38150126 100644 --- a/flang/runtime/descriptor.cpp +++ b/flang/runtime/descriptor.cpp @@ -8,6 +8,7 @@ #include "flang/Runtime/descriptor.h" #include "ISO_Fortran_util.h" +#include "allocator-registry.h" #include "derived.h" #include "memory.h" #include "stat.h" @@ -50,7 +51,9 @@ RT_API_ATTRS void Descriptor::Establish(TypeCode t, std::size_t elementBytes, GetDimension(j).SetByteStride(0); } } - raw_.f18Addendum = addendum; + if (addendum) { + SetHasAddendum(); + } DescriptorAddendum *a{Addendum()}; RUNTIME_CHECK(terminator, addendum == (a != nullptr)); if (a) { @@ -162,7 +165,9 @@ RT_API_ATTRS int Descriptor::Allocate() { // Zero size allocation is possible in Fortran and the resulting // descriptor must be allocated/associated. Since std::malloc(0) // result is implementation defined, always allocate at least one byte. - void *p{byteSize ? std::malloc(byteSize) : std::malloc(1)}; + + AllocFct alloc{allocatorRegistry.GetAllocator(GetAllocIdx())}; + void *p{alloc(byteSize ? byteSize : 1)}; if (!p) { return CFI_ERROR_MEM_ALLOCATION; } @@ -204,7 +209,8 @@ RT_API_ATTRS int Descriptor::Deallocate() { if (!descriptor.base_addr) { return CFI_ERROR_BASE_ADDR_NULL; } else { - std::free(descriptor.base_addr); + FreeFct free{allocatorRegistry.GetDeallocator(GetAllocIdx())}; + free(descriptor.base_addr); descriptor.base_addr = nullptr; return CFI_SUCCESS; } @@ -290,7 +296,9 @@ void Descriptor::Dump(FILE *f) const { std::fprintf(f, " rank %d\n", static_cast(raw_.rank)); std::fprintf(f, " type %d\n", static_cast(raw_.type)); std::fprintf(f, " attribute %d\n", static_cast(raw_.attribute)); - std::fprintf(f, " addendum %d\n", static_cast(raw_.f18Addendum)); + std::fprintf(f, " extra %d\n", static_cast(raw_.extra)); + std::fprintf(f, " addendum %d\n", static_cast(HasAddendum())); + std::fprintf(f, " alloc_idx %d\n", static_cast(GetAllocIdx())); for (int j{0}; j < raw_.rank; ++j) { std::fprintf(f, " dim[%d] lower_bound %jd\n", j, static_cast(raw_.dim[j].lower_bound)); diff --git a/flang/test/Fir/box.fir b/flang/test/Fir/box.fir index 1a9c9e049681..81a4d8bc13bf 100644 --- a/flang/test/Fir/box.fir +++ b/flang/test/Fir/box.fir @@ -1,7 +1,7 @@ // RUN: tco -o - %s | FileCheck %s // Global box initialization (test must come first because llvm globals are emitted first). -// CHECK-LABEL: @globalx = internal global { ptr, i64, i32, i8, i8, i8, i8 } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 9, i8 2, i8 0 } +// CHECK-LABEL: @globalx = internal global { ptr, i64, i32, i8, i8, i8, i8 } { ptr null, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 9, i8 2, i8 0 } fir.global internal @globalx : !fir.box> { %c0 = arith.constant 0 : index %0 = fir.convert %c0 : (index) -> !fir.heap @@ -9,7 +9,7 @@ fir.global internal @globalx : !fir.box> { fir.has_value %1 : !fir.box> } -// CHECK-LABEL: @globaly = internal global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 2, i8 0,{{.*}}[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)] +// CHECK-LABEL: @globaly = internal global { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } { ptr null, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 2, i8 0,{{.*}}[3 x i64] [i64 1, i64 0, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)] fir.global internal @globaly : !fir.box>> { %c0 = arith.constant 0 : index %0 = fir.convert %c0 : (index) -> !fir.heap> @@ -27,7 +27,7 @@ func.func private @ga(%b : !fir.box>) // CHECK: (ptr %[[ARG:.*]]) func.func @f(%a : !fir.ref) { // CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8 } - // CHECK: %[[INS0:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 27, i8 0, i8 0 }, ptr %[[ARG]], 0 + // CHECK: %[[INS0:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 27, i8 0, i8 0 }, ptr %[[ARG]], 0 // CHECK: store {{.*}} %[[INS0]], {{.*}} %[[DESC]] %b = fir.embox %a : (!fir.ref) -> !fir.box @@ -44,7 +44,7 @@ func.func @fa(%a : !fir.ref>) { %c1 = arith.constant 1 : index %c100 = arith.constant 100 : index %d = fir.shape %c100 : (index) -> !fir.shape<1> - // CHECK: %[[INS70:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 0, i8 0, {{.*}} }, ptr %{{.*}}, 0 + // CHECK: %[[INS70:.*]] = insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 0, i8 0, {{.*}} }, ptr %{{.*}}, 0 %b = fir.embox %c(%d) : (!fir.ref>, !fir.shape<1>) -> !fir.box> // CHECK: call void @ga( fir.call @ga(%b) : (!fir.box>) -> () @@ -58,7 +58,7 @@ func.func @fa(%a : !fir.ref>) { func.func @b1(%arg0 : !fir.ref>, %arg1 : index) -> !fir.box> { // CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]] // CHECK: insertvalue {{.*}} undef, i64 %[[size]], 1 - // CHECK: insertvalue {{.*}} i32 20180515, 2 + // CHECK: insertvalue {{.*}} i32 20240719, 2 // CHECK: insertvalue {{.*}} ptr %[[arg0]], 0 %x = fir.embox %arg0 typeparams %arg1 : (!fir.ref>, index) -> !fir.box> // CHECK: store {{.*}}, ptr %[[res]] @@ -71,7 +71,7 @@ func.func @b1(%arg0 : !fir.ref>, %arg1 : index) -> !fir.box>>, %arg1 : index) -> !fir.box>> { %1 = fir.shape %arg1 : (index) -> !fir.shape<1> - // CHECK: insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), i32 20180515, i8 1, i8 40, i8 0, i8 0, {{.*}} }, i64 %[[arg1]], 7, 0, 1 + // CHECK: insertvalue {{.*}} { ptr undef, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), i32 20240719, i8 1, i8 40, i8 0, i8 0, {{.*}} }, i64 %[[arg1]], 7, 0, 1 // CHECK: insertvalue {{.*}} %{{.*}}, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), 7, 0, 2 // CHECK: insertvalue {{.*}} ptr %[[arg0]], 0 %2 = fir.embox %arg0(%1) : (!fir.ref>>, !fir.shape<1>) -> !fir.box>> @@ -86,7 +86,7 @@ func.func @b3(%arg0 : !fir.ref>>, %arg1 : index, %ar %1 = fir.shape %arg2 : (index) -> !fir.shape<1> // CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]] // CHECK: insertvalue {{.*}} i64 %[[size]], 1 - // CHECK: insertvalue {{.*}} i32 20180515, 2 + // CHECK: insertvalue {{.*}} i32 20240719, 2 // CHECK: insertvalue {{.*}} i64 %[[arg2]], 7, 0, 1 // CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2 // CHECK: insertvalue {{.*}} ptr %[[arg0]], 0 @@ -103,7 +103,7 @@ func.func @b4(%arg0 : !fir.ref>>, %arg1 : index) -> %1 = fir.shape %c_7 : (index) -> !fir.shape<1> // CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]] // CHECK: insertvalue {{.*}} i64 %[[size]], 1 - // CHECK: insertvalue {{.*}} i32 20180515, 2 + // CHECK: insertvalue {{.*}} i32 20240719, 2 // CHECK: insertvalue {{.*}} i64 7, 7, 0, 1 // CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2 // CHECK: insertvalue {{.*}} ptr %[[arg0]], 0 @@ -147,7 +147,7 @@ func.func @box6(%0 : !fir.ref>, %1 : index, %2 : index) // CHECK: %[[sdp2:.*]] = sdiv i64 %[[dp2]], 2 // CHECK: %[[cmp:.*]] = icmp sgt i64 %[[sdp2]], 0 // CHECK: %[[extent:.*]] = select i1 %[[cmp]], i64 %[[sdp2]], i64 0 - // CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 2, i8 27, i8 0, i8 0, [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 undef, i64 undef], [3 x i64] undef] }, i64 %[[extent]], 7, 0, 1 + // CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 2, i8 27, i8 0, i8 0, [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 undef, i64 undef], [3 x i64] undef] }, i64 %[[extent]], 7, 0, 1 // CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %{{.*}}, i64 mul (i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i64 200), 7, 0, 2 // CHECK: %[[op25:.*]] = add i64 25000, %[[i100p40]] // CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %{{.*}}, i64 1, 7, 1, 0 diff --git a/flang/test/Fir/convert-to-llvm.fir b/flang/test/Fir/convert-to-llvm.fir index c7f3160328f7..af9b928cb4b1 100644 --- a/flang/test/Fir/convert-to-llvm.fir +++ b/flang/test/Fir/convert-to-llvm.fir @@ -1653,7 +1653,7 @@ func.func @embox0(%arg0: !fir.ref>) { // CHECK: %[[I64_ELEM_SIZE:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64 // CHECK: %[[DESC:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[I64_ELEM_SIZE]], %[[DESC]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> -// CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[CFI_VERSION]], %[[DESC0]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})> // CHECK: %[[RANK:.*]] = llvm.mlir.constant(0 : i32) : i32 // CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8 @@ -1785,11 +1785,10 @@ func.func @embox1(%arg0: !fir.ref>) { // CHECK-NO-COMDAT: llvm.mlir.global linkonce constant @_QMtest_dinitE.dt.tseq() {addr_space = 0 : i32} : i8 // CHECK-LABEL: llvm.func @embox1 // CHECK: %[[TYPE_CODE:.*]] = llvm.mlir.constant(42 : i32) : i32 +// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 +// CHECK: %{{.*}} = llvm.insertvalue %[[VERSION]], %{{.*}}[2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> // CHECK: %[[TYPE_CODE_I8:.*]] = llvm.trunc %[[TYPE_CODE]] : i32 to i8 // CHECK: %{{.*}} = llvm.insertvalue %[[TYPE_CODE_I8]], %{{.*}}[4] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)> -// CHECK: %[[F18ADDENDUM:.*]] = llvm.mlir.constant(1 : i32) : i32 -// CHECK: %[[F18ADDENDUM_I8:.*]] = llvm.trunc %[[F18ADDENDUM]] : i32 to i8 -// CHECK: %{{.*}} = llvm.insertvalue %[[F18ADDENDUM_I8]], %{{.*}}[6] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)> // CHECK: %[[TDESC:.*]] = llvm.mlir.addressof @_QMtest_dinitE.dt.tseq : !llvm.ptr // CHECK: %{{.*}} = llvm.insertvalue %[[TDESC]], %{{.*}}[7] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)> @@ -1879,7 +1878,7 @@ func.func @xembox0(%arg0: !fir.ref>) { // CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64 // CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> // CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> -// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> // CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8 @@ -1981,7 +1980,7 @@ func.func private @_QPxb(!fir.box>) // CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64 // CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)> // CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)> -// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)> // CHECK: %[[RANK:.*]] = llvm.mlir.constant(2 : i32) : i32 // CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8 @@ -2065,7 +2064,7 @@ func.func private @_QPtest_dt_callee(%arg0: !fir.box>) // CHECK: %[[ELEM_LEN_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64 // CHECK: %[[BOX0:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> // CHECK: %[[BOX1:.*]] = llvm.insertvalue %[[ELEM_LEN_I64]], %[[BOX0]][1] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> -// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[BOX2:.*]] = llvm.insertvalue %[[VERSION]], %[[BOX1]][2] : !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i64>>)> // CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8 @@ -2368,7 +2367,7 @@ func.func @test_rebox_1(%arg0: !fir.box>) { //CHECK: %[[ELEM_SIZE_I64:.*]] = llvm.ptrtoint %[[GEP]] : !llvm.ptr to i64 //CHECK: %[[RBOX:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> //CHECK: %[[RBOX_TMP1:.*]] = llvm.insertvalue %[[ELEM_SIZE_I64]], %[[RBOX]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> -//CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +//CHECK: %[[CFI_VERSION:.*]] = llvm.mlir.constant(20240719 : i32) : i32 //CHECK: %[[RBOX_TMP2:.*]] = llvm.insertvalue %[[CFI_VERSION]], %[[RBOX_TMP1]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> //CHECK: %[[RANK:.*]] = llvm.mlir.constant(1 : i32) : i32 //CHECK: %[[RANK_I8:.*]] = llvm.trunc %[[RANK]] : i32 to i8 diff --git a/flang/test/Fir/embox-char.fir b/flang/test/Fir/embox-char.fir index 30015a5f7ae3..bf8344dbb60f 100644 --- a/flang/test/Fir/embox-char.fir +++ b/flang/test/Fir/embox-char.fir @@ -46,7 +46,7 @@ // CHECK: %[[VAL_36_BYTESIZE:.*]] = llvm.mul %[[VAL_35]], %[[VAL_31_LEN]] : i64 // CHECK: %[[VAL_37:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> // CHECK: %[[VAL_38:.*]] = llvm.insertvalue %[[VAL_36_BYTESIZE]], %[[VAL_37]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> -// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[VAL_40:.*]] = llvm.insertvalue %[[VAL_39]], %[[VAL_38]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> // CHECK: %[[VAL_41:.*]] = llvm.mlir.constant(2 : i32) : i32 // CHECK: %[[VAL_42:.*]] = llvm.trunc %[[VAL_41]] : i32 to i8 @@ -142,7 +142,7 @@ func.func @test_char4(%arg0: !fir.ref>)> // CHECK: %[[VAL_38:.*]] = llvm.insertvalue %[[VAL_36_BYTESIZE]], %[[VAL_37]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> -// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VAL_39:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[VAL_40:.*]] = llvm.insertvalue %[[VAL_39]], %[[VAL_38]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> // CHECK: %[[VAL_41:.*]] = llvm.mlir.constant(2 : i32) : i32 // CHECK: %[[VAL_42:.*]] = llvm.trunc %[[VAL_41]] : i32 to i8 diff --git a/flang/test/Fir/embox.fir b/flang/test/Fir/embox.fir index 65a536d10c47..049328501dcc 100644 --- a/flang/test/Fir/embox.fir +++ b/flang/test/Fir/embox.fir @@ -13,7 +13,7 @@ func.func @_QPtest_slice() { // CHECK: %[[a2:.*]] = alloca [20 x i32], i64 1, align 4 // CHECK: %[[a3:.*]] = getelementptr [20 x i32], ptr %[[a2]], i64 0, i64 0 // CHECK: %[[a4:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } -// CHECK: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]] +// CHECK: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]] // CHECK: [i64 1, i64 5, i64 mul (i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i64 2)]] }, ptr %[[a3]], 0 // CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[a4]], ptr %[[a1]], align 8 // CHECK: call void @_QPtest_callee(ptr %[[a1]]) @@ -40,7 +40,7 @@ func.func @_QPtest_dt_slice() { // CHECK: %[[a3:.*]] = alloca [20 x %_QFtest_dt_sliceTt], i64 1, align 8 // CHECK: %[[a4:.*]] = getelementptr [20 x %_QFtest_dt_sliceTt], ptr %[[a3]], i64 0, i64 0, i32 0 // CHECK: %[[a5:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } -// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]] +// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, i8 0, i8 0, [1 x [3 x i64]] // CHECK-SAME: [i64 1, i64 5, i64 mul // CHECK-SAME: (i64 ptrtoint (ptr getelementptr (%_QFtest_dt_sliceTt, ptr null, i32 1) to i64), i64 2)]] } // CHECK-SAME: , ptr %[[a4]], 0 @@ -75,7 +75,7 @@ func.func @emboxSubstring(%arg0: !fir.ref>>) { %1 = fir.slice %c1, %c2, %c1, %c1, %c3, %c1 substr %c1_i64, %c2_i64 : (index, index, index, index, index, index, i64, i64) -> !fir.slice<2> %2 = fir.embox %arg0(%0) [%1] : (!fir.ref>>, !fir.shape<2>, !fir.slice<2>) -> !fir.box>> // CHECK: %[[addr:.*]] = getelementptr [3 x [2 x [4 x i8]]], ptr %[[arg0]], i64 0, i64 0, i64 0, i64 1 - // CHECK: insertvalue {[[descriptorType:.*]]} { ptr undef, i64 mul (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 2), i32 20180515, i8 2, i8 40, i8 0, i8 0 + // CHECK: insertvalue {[[descriptorType:.*]]} { ptr undef, i64 mul (i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), i64 2), i32 20240719, i8 2, i8 40, i8 0, i8 0 // CHECK-SAME: [2 x [3 x i64]] [{{\[}}3 x i64] [i64 1, i64 2, i64 4], [3 x i64] [i64 1, i64 3, i64 8]] } // CHECK-SAME: ptr %[[addr]], 0 @@ -98,7 +98,7 @@ func.func @fir_dev_issue_1416(%arg0: !fir.ref>, %low: index // CHECK: %[[offset:.*]] = add i64 %[[mul]], 0 // CHECK: %[[addr:.*]] = getelementptr [40 x float], ptr %0, i64 %[[offset]], i64 0 // CHECK: %[[box:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } -// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 27, i8 0, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 40, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]] }, ptr %[[addr]], 0 +// CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 27, i8 0, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 40, i64 ptrtoint (ptr getelementptr (float, ptr null, i32 1) to i64)]] }, ptr %[[addr]], 0 %3 = fir.embox %arg0(%1) [%2] : (!fir.ref>, !fir.shapeshift<2>, !fir.slice<2>) -> !fir.box> fir.call @do_something(%3) : (!fir.box>) -> () return diff --git a/flang/test/Fir/ignore-missing-type-descriptor.fir b/flang/test/Fir/ignore-missing-type-descriptor.fir index e83c8d684f89..228d9a1c7af6 100644 --- a/flang/test/Fir/ignore-missing-type-descriptor.fir +++ b/flang/test/Fir/ignore-missing-type-descriptor.fir @@ -18,5 +18,5 @@ func.func @test_embox(%addr: !fir.ref) { // CHECK-SAME: ptr %[[ADDR:.*]]) // CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } // CHECK-SAME: { ptr undef, i64 ptrtoint (ptr getelementptr (%some_not_mangled_type, ptr null, i32 1) to i64), -// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 0, i8 1, ptr null, [1 x i64] zeroinitializer }, +// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr null, [1 x i64] zeroinitializer }, // CHECK-SAME: ptr %[[ADDR]], 0 diff --git a/flang/test/Fir/polymorphic.fir b/flang/test/Fir/polymorphic.fir index fc891c32acc9..7493c7012e92 100644 --- a/flang/test/Fir/polymorphic.fir +++ b/flang/test/Fir/polymorphic.fir @@ -13,7 +13,7 @@ func.func @_QMpolymorphic_testPtest_allocate_unlimited_polymorphic_non_derived() // CHECK-LABEL: define void @_QMpolymorphic_testPtest_allocate_unlimited_polymorphic_non_derived(){{.*}}{ // CHECK: %[[MEM:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } // CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, i64 1 -// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 0, i32 20180515, i8 0, i8 -1, i8 1, i8 1, ptr null, [1 x i64] zeroinitializer }, ptr %[[MEM]] +// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 0, i32 20240719, i8 0, i8 -1, i8 1, i8 1, ptr null, [1 x i64] zeroinitializer }, ptr %[[MEM]] // CHECK: %[[LOADED:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[MEM]], align 8 // CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOADED]], ptr %[[DESC]] // CHECK: ret void @@ -64,7 +64,7 @@ func.func @_QMpolymorphic_testPtest_embox() { // CHECK-LABEL: @_QMpolymorphic_testPtest_embox() // CHECK: %[[ALLOCA_DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } -// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } { ptr @_QFEy, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20180515, i8 1, i8 9, {{.*}}, ptr %[[ALLOCA_DESC]] +// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } { ptr @_QFEy, i64 ptrtoint (ptr getelementptr (i32, ptr null, i32 1) to i64), i32 20240719, i8 1, i8 9, {{.*}}, ptr %[[ALLOCA_DESC]] // CHECK: %[[LOADED_DESC:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %[[ALLOCA_DESC]], align 8 // CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] } %[[LOADED_DESC]], ptr @_QFEx, align 8 @@ -155,7 +155,7 @@ func.func @_QQmain() { // CHECK-LABEL: define void @_QQmain(){{.*}}{ // CHECK: %[[CLASS_NONE:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } // CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, i64 1 -// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1E.dt.t.2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8 +// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr @_QMmod1Ea, i64 ptrtoint (ptr getelementptr (%_QMmod1TtK2, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 1, i8 1, ptr @_QMmod1E.dt.t.2, [1 x i64] zeroinitializer }, ptr %[[CLASS_NONE]], align 8 // CHECK: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[CLASS_NONE]] // CHECK: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[DESC]] // CHECK: call void @_QMmod1Psub1(ptr %[[DESC]]) @@ -195,4 +195,4 @@ func.func @_QQembox_input_type(%arg0 : !fir.ref>> { fir.has_value %2 : !fir.box>> } // CHECK-LABEL: @pointer_char4_init -// CHECK-SAME: { ptr @char4, i64 ptrtoint (ptr getelementptr ([10 x i32], ptr null, i32 1) to i64), i32 20180515, i8 0, i8 44, i8 1, i8 0 } +// CHECK-SAME: { ptr @char4, i64 ptrtoint (ptr getelementptr ([10 x i32], ptr null, i32 1) to i64), i32 20240719, i8 0, i8 44, i8 1, i8 0 } diff --git a/flang/test/Fir/rebox.fir b/flang/test/Fir/rebox.fir index d2d886cf2e21..d0393eadef58 100644 --- a/flang/test/Fir/rebox.fir +++ b/flang/test/Fir/rebox.fir @@ -121,7 +121,7 @@ func.func @test_rebox_4(%arg0: !fir.box>>) { // CHECK: %[[STRIDE:.*]] = load i64, ptr %[[STRIDE_GEP]] // CHECK: %[[BASE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %[[INPUT]], i32 0, i32 0 // CHECK: %[[BASE:.*]] = load ptr, ptr %[[BASE_GEP]] - // CHECK: %[[NEWBOX1:.*]] = insertvalue {{{.*}}} { ptr undef, i64 ptrtoint (ptr getelementptr ([10 x i8], ptr null, i32 1) to i64), i32 20180515, i8 1, i8 40, i8 1, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 undef, i64 undef]] }, i64 %[[EXTENT]], 7, 0, 1 + // CHECK: %[[NEWBOX1:.*]] = insertvalue {{{.*}}} { ptr undef, i64 ptrtoint (ptr getelementptr ([10 x i8], ptr null, i32 1) to i64), i32 20240719, i8 1, i8 40, i8 1, i8 0, [1 x [3 x i64]] [{{.*}} [i64 1, i64 undef, i64 undef]] }, i64 %[[EXTENT]], 7, 0, 1 // CHECK: %[[NEWBOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX1]], i64 %[[STRIDE]], 7, 0, 2 // CHECK: %[[NEWBOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX2]], ptr %[[BASE]], 0 // CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[NEWBOX3]], ptr %[[NEWBOX_STORAGE]] diff --git a/flang/test/Fir/tbaa.fir b/flang/test/Fir/tbaa.fir index 89679afc386c..32e264519388 100644 --- a/flang/test/Fir/tbaa.fir +++ b/flang/test/Fir/tbaa.fir @@ -54,7 +54,7 @@ module { // CHECK: %[[VAL_23:.*]] = llvm.load %[[VAL_22]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i32 // CHECK: %[[VAL_24:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> // CHECK: %[[VAL_25:.*]] = llvm.insertvalue %[[VAL_21]], %[[VAL_24]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> -// CHECK: %[[VAL_26:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VAL_26:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[VAL_27:.*]] = llvm.insertvalue %[[VAL_26]], %[[VAL_25]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> // CHECK: %[[VAL_28:.*]] = llvm.mlir.constant(0 : i32) : i32 // CHECK: %[[VAL_29:.*]] = llvm.trunc %[[VAL_28]] : i32 to i8 @@ -154,7 +154,7 @@ module { // CHECK: %[[VAL_27:.*]] = llvm.load %[[VAL_26]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr // CHECK: %[[VAL_28:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> // CHECK: %[[VAL_29:.*]] = llvm.insertvalue %[[VAL_23]], %[[VAL_28]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> -// CHECK: %[[VAL_30:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VAL_30:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[VAL_31:.*]] = llvm.insertvalue %[[VAL_30]], %[[VAL_29]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> // CHECK: %[[VAL_32:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[VAL_33:.*]] = llvm.trunc %[[VAL_32]] : i32 to i8 @@ -206,7 +206,7 @@ module { // CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(-1 : i32) : i32 // CHECK: %[[VAL_4:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> // CHECK: %[[VAL_5:.*]] = llvm.insertvalue %[[VAL_2]], %[[VAL_4]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> -// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(20180515 : i32) : i32 +// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(20240719 : i32) : i32 // CHECK: %[[VAL_7:.*]] = llvm.insertvalue %[[VAL_6]], %[[VAL_5]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> // CHECK: %[[VAL_8:.*]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[VAL_9:.*]] = llvm.trunc %[[VAL_8]] : i32 to i8 diff --git a/flang/test/Fir/type-descriptor.fir b/flang/test/Fir/type-descriptor.fir index 6551efe1a5fe..f0ebd8ddeee1 100644 --- a/flang/test/Fir/type-descriptor.fir +++ b/flang/test/Fir/type-descriptor.fir @@ -14,7 +14,7 @@ fir.global internal @_QFfooEx : !fir.box> { } // CHECK: @_QFfooEx = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } // CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsometype, ptr null, i32 1) to i64), -// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.sometype, [1 x i64] zeroinitializer } +// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.sometype, [1 x i64] zeroinitializer } !some_pdt_type = !fir.type<_QFfooTsome_pdt_typeK42K43{num:i32,values:!fir.box>>}> fir.global internal @_QFfooE.dt.some_pdt_type.42.43 constant : i8 @@ -26,4 +26,4 @@ fir.global internal @_QFfooEx2 : !fir.box> { } // CHECK: @_QFfooEx2 = internal global { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } // CHECK-SAME: { ptr null, i64 ptrtoint (ptr getelementptr (%_QFfooTsome_pdt_typeK42K43, ptr null, i32 1) to i64), -// CHECK-SAME: i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.some_pdt_type.42.43, [1 x i64] zeroinitializer } +// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QFfooE.dt.some_pdt_type.42.43, [1 x i64] zeroinitializer } diff --git a/flang/test/Lower/allocatable-polymorphic.f90 b/flang/test/Lower/allocatable-polymorphic.f90 index e96945ef89e5..7632b22f98b7 100644 --- a/flang/test/Lower/allocatable-polymorphic.f90 +++ b/flang/test/Lower/allocatable-polymorphic.f90 @@ -643,7 +643,7 @@ end ! LLVM: %[[TYPE_CODE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %{{.*}}, i32 0, i32 4 ! LLVM: %[[TYPE_CODE:.*]] = load i32, ptr %[[TYPE_CODE_GEP]] ! LLVM: %[[BOX0:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } undef, i64 %[[ELE_SIZE]], 1 -! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20180515, 2 +! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20240719, 2 ! LLVM: %[[BOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX1]], i8 0, 3 ! LLVM: %[[TYPE_CODE_TRUNC:.*]] = trunc i32 %[[TYPE_CODE]] to i8 ! LLVM: %[[BOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX2]], i8 %[[TYPE_CODE_TRUNC]], 4 @@ -664,7 +664,7 @@ end ! LLVM: %[[TYPE_CODE_GEP:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]], ptr, [1 x i64] }, ptr %{{.*}}, i32 0, i32 4 ! LLVM: %[[TYPE_CODE:.*]] = load i32, ptr %[[TYPE_CODE_GEP]] ! LLVM: %[[BOX0:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } undef, i64 %[[ELE_SIZE]], 1 -! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20180515, 2 +! LLVM: %[[BOX1:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX0]], i32 20240719, 2 ! LLVM: %[[BOX2:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX1]], i8 0, 3 ! LLVM: %[[TYPE_CODE_TRUNC:.*]] = trunc i32 %[[TYPE_CODE]] to i8 ! LLVM: %[[BOX3:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[BOX2]], i8 %[[TYPE_CODE_TRUNC]], 4 @@ -681,7 +681,7 @@ end ! allocatable. ! LLVM-LABEL: define void @_QMpolyPtest_deallocate() -! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20180515, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyE.dt.p1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]] +! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } { ptr null, i64 ptrtoint (ptr getelementptr (%_QMpolyTp1, ptr null, i32 1) to i64), i32 20240719, i8 0, i8 42, i8 2, i8 1, ptr @_QMpolyE.dt.p1, [1 x i64] zeroinitializer }, ptr %[[ALLOCA1:[0-9]*]] ! LLVM: %[[LOAD:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] }, ptr %[[ALLOCA1]] ! LLVM: store { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } %[[LOAD]], ptr %[[ALLOCA2:[0-9]*]] ! LLVM: %{{.*}} = call {} @_FortranAAllocatableInitDerivedForAllocate(ptr %[[ALLOCA2]], ptr @_QMpolyE.dt.p1, i32 0, i32 0)