Skip to content

Commit 7118b77

Browse files
committed
[flang] Add allocator for descriptor data
1 parent cc7aef9 commit 7118b77

23 files changed

+171
-57
lines changed

flang/include/flang/ISO_Fortran_binding.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#endif
3131

3232
/* 18.5.4 */
33-
#define CFI_VERSION 20180515
33+
#define CFI_VERSION 20240719
3434

3535
#define CFI_MAX_RANK 15
3636
typedef unsigned char CFI_rank_t;
@@ -146,7 +146,10 @@ extern "C++" template <typename T> struct FlexibleArray : T {
146146
CFI_rank_t rank; /* [0 .. CFI_MAX_RANK] */ \
147147
CFI_type_t type; \
148148
CFI_attribute_t attribute; \
149-
unsigned char f18Addendum;
149+
/* The lsb of this field indicates the presence of the f18Addendum. Other \
150+
* bits are used to specify the index of the allocator used to managed \
151+
* memory of the data hold by the descriptor. */ \
152+
unsigned char extra;
150153

151154
typedef struct CFI_cdesc_t {
152155
_CFI_CDESC_T_HEADER_MEMBERS
@@ -155,6 +158,11 @@ typedef struct CFI_cdesc_t {
155158
#else
156159
CFI_dim_t dim[]; /* must appear last */
157160
#endif
161+
162+
#ifdef __cplusplus
163+
RT_API_ATTRS inline bool HasAddendum() const { return extra & 1; }
164+
RT_API_ATTRS inline int GetAllocIdx() const { return ((int)extra >> 1); }
165+
#endif
158166
} CFI_cdesc_t;
159167

160168
/* 18.5.4 */

flang/include/flang/Optimizer/CodeGen/TBAABuilder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace fir {
5555
// <@type_desc_3, 20>, // rank
5656
// <@type_desc_3, 21>, // type
5757
// <@type_desc_3, 22>, // attribute
58-
// <@type_desc_3, 23>} // f18Addendum
58+
// <@type_desc_3, 23>} // extra
5959
// }
6060
// llvm.tbaa_type_desc @type_desc_5 {
6161
// id = "CFI_cdesc_t_dim1",
@@ -65,7 +65,7 @@ namespace fir {
6565
// <@type_desc_3, 20>, // rank
6666
// <@type_desc_3, 21>, // type
6767
// <@type_desc_3, 22>, // attribute
68-
// <@type_desc_3, 23>, // f18Addendum
68+
// <@type_desc_3, 23>, // extra
6969
// <@type_desc_3, 24>, // dim[0].lower_bound
7070
// <@type_desc_3, 32>, // dim[0].extent
7171
// <@type_desc_3, 40>} // dim[0].sm
@@ -78,7 +78,7 @@ namespace fir {
7878
// <@type_desc_3, 20>, // rank
7979
// <@type_desc_3, 21>, // type
8080
// <@type_desc_3, 22>, // attribute
81-
// <@type_desc_3, 23>, // f18Addendum
81+
// <@type_desc_3, 23>, // extra
8282
// <@type_desc_3, 24>, // dim[0].lower_bound
8383
// <@type_desc_3, 32>, // dim[0].extent
8484
// <@type_desc_3, 40>, // dim[0].sm

flang/include/flang/Optimizer/CodeGen/TypeConverter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static constexpr unsigned kVersionPosInBox = 2;
2929
static constexpr unsigned kRankPosInBox = 3;
3030
static constexpr unsigned kTypePosInBox = 4;
3131
static constexpr unsigned kAttributePosInBox = 5;
32-
static constexpr unsigned kF18AddendumPosInBox = 6;
32+
static constexpr unsigned kExtraPosInBox = 6;
3333
static constexpr unsigned kDimsPosInBox = 7;
3434
static constexpr unsigned kOptTypePtrPosInBox = 8;
3535
static constexpr unsigned kOptRowTypePosInBox = 9;

flang/include/flang/Runtime/descriptor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ class Dimension {
9292
// The storage for this object follows the last used dim[] entry in a
9393
// Descriptor (CFI_cdesc_t) generic descriptor. Space matters here, since
9494
// descriptors serve as POINTER and ALLOCATABLE components of derived type
95-
// instances. The presence of this structure is implied by the flag
96-
// CFI_cdesc_t.f18Addendum, and the number of elements in the len_[]
95+
// instances. The presence of this structure is implied by the lsb of
96+
// CFI_cdesc_t.extra set to 1, and the number of elements in the len_[]
9797
// array is determined by derivedType_->LenParameters().
9898
class DescriptorAddendum {
9999
public:
@@ -339,14 +339,14 @@ class Descriptor {
339339
const SubscriptValue *, const int *permutation = nullptr) const;
340340

341341
RT_API_ATTRS DescriptorAddendum *Addendum() {
342-
if (raw_.f18Addendum != 0) {
342+
if (raw_.HasAddendum()) {
343343
return reinterpret_cast<DescriptorAddendum *>(&GetDimension(rank()));
344344
} else {
345345
return nullptr;
346346
}
347347
}
348348
RT_API_ATTRS const DescriptorAddendum *Addendum() const {
349-
if (raw_.f18Addendum != 0) {
349+
if (raw_.HasAddendum()) {
350350
return reinterpret_cast<const DescriptorAddendum *>(
351351
&GetDimension(rank()));
352352
} else {

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,9 +1241,10 @@ struct EmboxCommonConversion : public fir::FIROpConversion<OP> {
12411241
descriptor =
12421242
insertField(rewriter, loc, descriptor, {kAttributePosInBox},
12431243
this->genI32Constant(loc, rewriter, getCFIAttr(boxTy)));
1244+
12441245
const bool hasAddendum = fir::boxHasAddendum(boxTy);
12451246
descriptor =
1246-
insertField(rewriter, loc, descriptor, {kF18AddendumPosInBox},
1247+
insertField(rewriter, loc, descriptor, {kExtraPosInBox},
12471248
this->genI32Constant(loc, rewriter, hasAddendum ? 1 : 0));
12481249

12491250
if (hasAddendum) {

flang/lib/Optimizer/CodeGen/TypeConverter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ bool LLVMTypeConverter::requiresExtendedDesc(mlir::Type boxElementType) const {
177177
// the addendum defined in descriptor.h.
178178
mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box,
179179
int rank) const {
180-
// (base_addr*, elem_len, version, rank, type, attribute, f18Addendum, [dim]
180+
// (base_addr*, elem_len, version, rank, type, attribute, extra, [dim]
181181
llvm::SmallVector<mlir::Type> dataDescFields;
182182
mlir::Type ele = box.getEleTy();
183183
// remove fir.heap/fir.ref/fir.ptr
@@ -206,9 +206,9 @@ mlir::Type LLVMTypeConverter::convertBoxTypeAsStruct(BaseBoxType box,
206206
// attribute
207207
dataDescFields.push_back(
208208
getDescFieldTypeModel<kAttributePosInBox>()(&getContext()));
209-
// f18Addendum
209+
// extra
210210
dataDescFields.push_back(
211-
getDescFieldTypeModel<kF18AddendumPosInBox>()(&getContext()));
211+
getDescFieldTypeModel<kExtraPosInBox>()(&getContext()));
212212
// [dims]
213213
if (rank == unknownRank()) {
214214
if (auto seqTy = mlir::dyn_cast<SequenceType>(ele))

flang/runtime/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ add_subdirectory(Float128Math)
107107

108108
set(sources
109109
ISO_Fortran_binding.cpp
110+
allocator-registry.cpp
110111
allocatable.cpp
111112
array-constructor.cpp
112113
assign.cpp
@@ -178,6 +179,7 @@ include(AddFlangOffloadRuntime)
178179
set(supported_files
179180
ISO_Fortran_binding.cpp
180181
allocatable.cpp
182+
allocator-registry.cpp
181183
array-constructor.cpp
182184
assign.cpp
183185
buffer.cpp

flang/runtime/ISO_Fortran_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static inline RT_API_ATTRS void EstablishDescriptor(CFI_cdesc_t *descriptor,
8686
descriptor->rank = rank;
8787
descriptor->type = type;
8888
descriptor->attribute = attribute;
89-
descriptor->f18Addendum = 0;
89+
descriptor->extra = 0;
9090
std::size_t byteSize{elem_len};
9191
constexpr std::size_t lower_bound{0};
9292
if (base_addr) {

flang/runtime/allocator-registry.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//===-- runtime/allocator-registry.cpp ------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "allocator-registry.h"
10+
#include "terminator.h"
11+
12+
namespace Fortran::runtime {
13+
14+
#ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
15+
RT_OFFLOAD_VAR_GROUP_BEGIN
16+
RT_VAR_ATTRS AllocatorRegistry allocatorRegistry;
17+
RT_OFFLOAD_VAR_GROUP_END
18+
#endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
19+
20+
RT_OFFLOAD_API_GROUP_BEGIN
21+
RT_API_ATTRS void AllocatorRegistry::Register(int pos, Allocator_t allocator) {
22+
// pos 0 is reserved for the default allocator and is registered in the
23+
// struct ctor.
24+
INTERNAL_CHECK(pos > 0 && pos < MAX_ALLOCATOR);
25+
allocators[pos] = allocator;
26+
}
27+
28+
RT_API_ATTRS AllocFct AllocatorRegistry::GetAllocator(int pos) {
29+
INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR);
30+
AllocFct f{allocators[pos].alloc};
31+
INTERNAL_CHECK(f != nullptr);
32+
return f;
33+
}
34+
35+
RT_API_ATTRS FreeFct AllocatorRegistry::GetDeallocator(int pos) {
36+
INTERNAL_CHECK(pos >= 0 && pos < MAX_ALLOCATOR);
37+
FreeFct f{allocators[pos].free};
38+
INTERNAL_CHECK(f != nullptr);
39+
return f;
40+
}
41+
RT_OFFLOAD_API_GROUP_END
42+
} // namespace Fortran::runtime

flang/runtime/allocator-registry.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//===-- runtime/allocator.h -------------------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef FORTRAN_RUNTIME_ALLOCATOR_H_
10+
#define FORTRAN_RUNTIME_ALLOCATOR_H_
11+
12+
#include "flang/Common/api-attrs.h"
13+
#include <cstdlib>
14+
#include <vector>
15+
16+
#define MAX_ALLOCATOR 5
17+
18+
namespace Fortran::runtime {
19+
20+
using AllocFct = void *(*)(std::size_t);
21+
using FreeFct = void (*)(void *);
22+
23+
typedef struct Allocator_t {
24+
AllocFct alloc{nullptr};
25+
FreeFct free{nullptr};
26+
} Allocator_t;
27+
28+
#ifdef RT_DEVICE_COMPILATION
29+
static RT_API_ATTRS void *MallocWrapper(std::size_t size) {
30+
return std::malloc(size);
31+
}
32+
static RT_API_ATTRS void FreeWrapper(void *p) { return std::free(p); }
33+
#endif
34+
35+
struct AllocatorRegistry {
36+
#ifdef RT_DEVICE_COMPILATION
37+
RT_API_ATTRS constexpr AllocatorRegistry()
38+
: allocators{{&MallocWrapper, &FreeWrapper}} {}
39+
#else
40+
constexpr AllocatorRegistry() { allocators[0] = {&std::malloc, &std::free}; };
41+
#endif
42+
RT_API_ATTRS void Register(int, Allocator_t);
43+
RT_API_ATTRS AllocFct GetAllocator(int pos);
44+
RT_API_ATTRS FreeFct GetDeallocator(int pos);
45+
46+
Allocator_t allocators[MAX_ALLOCATOR];
47+
};
48+
49+
RT_OFFLOAD_VAR_GROUP_BEGIN
50+
extern RT_VAR_ATTRS AllocatorRegistry allocatorRegistry;
51+
RT_OFFLOAD_VAR_GROUP_END
52+
53+
} // namespace Fortran::runtime
54+
55+
#endif // FORTRAN_RUNTIME_ALLOCATOR_H_

flang/runtime/descriptor.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "flang/Runtime/descriptor.h"
1010
#include "ISO_Fortran_util.h"
11+
#include "allocator-registry.h"
1112
#include "derived.h"
1213
#include "memory.h"
1314
#include "stat.h"
@@ -50,7 +51,9 @@ RT_API_ATTRS void Descriptor::Establish(TypeCode t, std::size_t elementBytes,
5051
GetDimension(j).SetByteStride(0);
5152
}
5253
}
53-
raw_.f18Addendum = addendum;
54+
if (addendum) {
55+
raw_.extra = raw_.extra | 1;
56+
}
5457
DescriptorAddendum *a{Addendum()};
5558
RUNTIME_CHECK(terminator, addendum == (a != nullptr));
5659
if (a) {
@@ -162,7 +165,9 @@ RT_API_ATTRS int Descriptor::Allocate() {
162165
// Zero size allocation is possible in Fortran and the resulting
163166
// descriptor must be allocated/associated. Since std::malloc(0)
164167
// result is implementation defined, always allocate at least one byte.
165-
void *p{byteSize ? std::malloc(byteSize) : std::malloc(1)};
168+
169+
AllocFct alloc{allocatorRegistry.GetAllocator(raw_.GetAllocIdx())};
170+
void *p{alloc(byteSize ? byteSize : 1)};
166171
if (!p) {
167172
return CFI_ERROR_MEM_ALLOCATION;
168173
}
@@ -204,7 +209,8 @@ RT_API_ATTRS int Descriptor::Deallocate() {
204209
if (!descriptor.base_addr) {
205210
return CFI_ERROR_BASE_ADDR_NULL;
206211
} else {
207-
std::free(descriptor.base_addr);
212+
FreeFct free{allocatorRegistry.GetDeallocator(descriptor.GetAllocIdx())};
213+
free(descriptor.base_addr);
208214
descriptor.base_addr = nullptr;
209215
return CFI_SUCCESS;
210216
}
@@ -290,7 +296,7 @@ void Descriptor::Dump(FILE *f) const {
290296
std::fprintf(f, " rank %d\n", static_cast<int>(raw_.rank));
291297
std::fprintf(f, " type %d\n", static_cast<int>(raw_.type));
292298
std::fprintf(f, " attribute %d\n", static_cast<int>(raw_.attribute));
293-
std::fprintf(f, " addendum %d\n", static_cast<int>(raw_.f18Addendum));
299+
std::fprintf(f, " extra %d\n", static_cast<int>(raw_.extra));
294300
for (int j{0}; j < raw_.rank; ++j) {
295301
std::fprintf(f, " dim[%d] lower_bound %jd\n", j,
296302
static_cast<std::intmax_t>(raw_.dim[j].lower_bound));

flang/test/Fir/box.fir

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// RUN: tco -o - %s | FileCheck %s
22

33
// Global box initialization (test must come first because llvm globals are emitted first).
4-
// 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 }
4+
// 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 }
55
fir.global internal @globalx : !fir.box<!fir.heap<i32>> {
66
%c0 = arith.constant 0 : index
77
%0 = fir.convert %c0 : (index) -> !fir.heap<i32>
88
%1 = fir.embox %0 : (!fir.heap<i32>) -> !fir.box<!fir.heap<i32>>
99
fir.has_value %1 : !fir.box<!fir.heap<i32>>
1010
}
1111

12-
// 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)]
12+
// 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)]
1313
fir.global internal @globaly : !fir.box<!fir.heap<!fir.array<?xf32>>> {
1414
%c0 = arith.constant 0 : index
1515
%0 = fir.convert %c0 : (index) -> !fir.heap<!fir.array<?xf32>>
@@ -27,7 +27,7 @@ func.func private @ga(%b : !fir.box<!fir.array<?xf32>>)
2727
// CHECK: (ptr %[[ARG:.*]])
2828
func.func @f(%a : !fir.ref<f32>) {
2929
// CHECK: %[[DESC:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8 }
30-
// 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
30+
// 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
3131
// CHECK: store {{.*}} %[[INS0]], {{.*}} %[[DESC]]
3232
%b = fir.embox %a : (!fir.ref<f32>) -> !fir.box<f32>
3333

@@ -44,7 +44,7 @@ func.func @fa(%a : !fir.ref<!fir.array<100xf32>>) {
4444
%c1 = arith.constant 1 : index
4545
%c100 = arith.constant 100 : index
4646
%d = fir.shape %c100 : (index) -> !fir.shape<1>
47-
// 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
47+
// 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
4848
%b = fir.embox %c(%d) : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xf32>>
4949
// CHECK: call void @ga(
5050
fir.call @ga(%b) : (!fir.box<!fir.array<?xf32>>) -> ()
@@ -58,7 +58,7 @@ func.func @fa(%a : !fir.ref<!fir.array<100xf32>>) {
5858
func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.char<1,?>> {
5959
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
6060
// CHECK: insertvalue {{.*}} undef, i64 %[[size]], 1
61-
// CHECK: insertvalue {{.*}} i32 20180515, 2
61+
// CHECK: insertvalue {{.*}} i32 20240719, 2
6262
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
6363
%x = fir.embox %arg0 typeparams %arg1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
6464
// CHECK: store {{.*}}, ptr %[[res]]
@@ -71,7 +71,7 @@ func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.
7171
// CHECK-SAME: ptr %[[arg0:.*]], i64 %[[arg1:.*]])
7272
func.func @b2(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,5>>>, %arg1 : index) -> !fir.box<!fir.array<?x!fir.char<1,5>>> {
7373
%1 = fir.shape %arg1 : (index) -> !fir.shape<1>
74-
// 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
74+
// 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
7575
// CHECK: insertvalue {{.*}} %{{.*}}, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), 7, 0, 2
7676
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
7777
%2 = fir.embox %arg0(%1) : (!fir.ref<!fir.array<?x!fir.char<1,5>>>, !fir.shape<1>) -> !fir.box<!fir.array<?x!fir.char<1,5>>>
@@ -86,7 +86,7 @@ func.func @b3(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,?>>>, %arg1 : index, %ar
8686
%1 = fir.shape %arg2 : (index) -> !fir.shape<1>
8787
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
8888
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
89-
// CHECK: insertvalue {{.*}} i32 20180515, 2
89+
// CHECK: insertvalue {{.*}} i32 20240719, 2
9090
// CHECK: insertvalue {{.*}} i64 %[[arg2]], 7, 0, 1
9191
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
9292
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
@@ -103,7 +103,7 @@ func.func @b4(%arg0 : !fir.ref<!fir.array<7x!fir.char<1,?>>>, %arg1 : index) ->
103103
%1 = fir.shape %c_7 : (index) -> !fir.shape<1>
104104
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
105105
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
106-
// CHECK: insertvalue {{.*}} i32 20180515, 2
106+
// CHECK: insertvalue {{.*}} i32 20240719, 2
107107
// CHECK: insertvalue {{.*}} i64 7, 7, 0, 1
108108
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
109109
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
@@ -147,7 +147,7 @@ func.func @box6(%0 : !fir.ref<!fir.array<?x?x?x?xf32>>, %1 : index, %2 : index)
147147
// CHECK: %[[sdp2:.*]] = sdiv i64 %[[dp2]], 2
148148
// CHECK: %[[cmp:.*]] = icmp sgt i64 %[[sdp2]], 0
149149
// CHECK: %[[extent:.*]] = select i1 %[[cmp]], i64 %[[sdp2]], i64 0
150-
// 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
150+
// 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
151151
// 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
152152
// CHECK: %[[op25:.*]] = add i64 25000, %[[i100p40]]
153153
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %{{.*}}, i64 1, 7, 1, 0

0 commit comments

Comments
 (0)