Skip to content

Commit 529a555

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/rounding-mode-sink
2 parents 6c7ec35 + d7e6cba commit 529a555

File tree

74 files changed

+15295
-3822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+15295
-3822
lines changed

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,10 +2590,6 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
25902590
if (it != BlockByrefInfos.end())
25912591
return it->second;
25922592

2593-
llvm::StructType *byrefType =
2594-
llvm::StructType::create(getLLVMContext(),
2595-
"struct.__block_byref_" + D->getNameAsString());
2596-
25972593
QualType Ty = D->getType();
25982594

25992595
CharUnits size;
@@ -2658,7 +2654,9 @@ const BlockByrefInfo &CodeGenFunction::getBlockByrefInfo(const VarDecl *D) {
26582654
}
26592655
types.push_back(varTy);
26602656

2661-
byrefType->setBody(types, packed);
2657+
llvm::StructType *byrefType = llvm::StructType::create(
2658+
getLLVMContext(), types, "struct.__block_byref_" + D->getNameAsString(),
2659+
packed);
26622660

26632661
BlockByrefInfo info;
26642662
info.Type = byrefType;

clang/lib/CodeGen/CGObjCGNU.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,8 +1509,8 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
15091509
GetSectionBounds(StringRef Section) {
15101510
if (CGM.getTriple().isOSBinFormatCOFF()) {
15111511
if (emptyStruct == nullptr) {
1512-
emptyStruct = llvm::StructType::create(VMContext, ".objc_section_sentinel");
1513-
emptyStruct->setBody({}, /*isPacked*/true);
1512+
emptyStruct = llvm::StructType::create(
1513+
VMContext, {}, ".objc_section_sentinel", /*isPacked=*/true);
15141514
}
15151515
auto ZeroInit = llvm::Constant::getNullValue(emptyStruct);
15161516
auto Sym = [&](StringRef Prefix, StringRef SecSuffix) {

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5835,15 +5835,7 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58355835
// struct _objc_protocol_extension *
58365836
ProtocolExtensionPtrTy = llvm::PointerType::getUnqual(ProtocolExtensionTy);
58375837

5838-
// Handle recursive construction of Protocol and ProtocolList types
5839-
5840-
ProtocolTy =
5841-
llvm::StructType::create(VMContext, "struct._objc_protocol");
5842-
5843-
ProtocolListTy =
5844-
llvm::StructType::create(VMContext, "struct._objc_protocol_list");
5845-
ProtocolListTy->setBody(llvm::PointerType::getUnqual(ProtocolListTy), LongTy,
5846-
llvm::ArrayType::get(ProtocolTy, 0));
5838+
// Handle construction of Protocol and ProtocolList types
58475839

58485840
// struct _objc_protocol {
58495841
// struct _objc_protocol_extension *isa;
@@ -5852,9 +5844,16 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58525844
// struct _objc_method_description_list *instance_methods;
58535845
// struct _objc_method_description_list *class_methods;
58545846
// }
5855-
ProtocolTy->setBody(ProtocolExtensionPtrTy, Int8PtrTy,
5856-
llvm::PointerType::getUnqual(ProtocolListTy),
5857-
MethodDescriptionListPtrTy, MethodDescriptionListPtrTy);
5847+
ProtocolTy = llvm::StructType::create(
5848+
{ProtocolExtensionPtrTy, Int8PtrTy,
5849+
llvm::PointerType::getUnqual(VMContext), MethodDescriptionListPtrTy,
5850+
MethodDescriptionListPtrTy},
5851+
"struct._objc_protocol");
5852+
5853+
ProtocolListTy =
5854+
llvm::StructType::create({llvm::PointerType::getUnqual(VMContext), LongTy,
5855+
llvm::ArrayType::get(ProtocolTy, 0)},
5856+
"struct._objc_protocol_list");
58585857

58595858
// struct _objc_protocol_list *
58605859
ProtocolListPtrTy = llvm::PointerType::getUnqual(ProtocolListTy);
@@ -5886,8 +5885,6 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
58865885
"struct._objc_class_extension", IntTy, Int8PtrTy, PropertyListPtrTy);
58875886
ClassExtensionPtrTy = llvm::PointerType::getUnqual(ClassExtensionTy);
58885887

5889-
ClassTy = llvm::StructType::create(VMContext, "struct._objc_class");
5890-
58915888
// struct _objc_class {
58925889
// Class isa;
58935890
// Class super_class;
@@ -5902,10 +5899,12 @@ ObjCTypesHelper::ObjCTypesHelper(CodeGen::CodeGenModule &cgm)
59025899
// char *ivar_layout;
59035900
// struct _objc_class_ext *ext;
59045901
// };
5905-
ClassTy->setBody(llvm::PointerType::getUnqual(ClassTy),
5906-
llvm::PointerType::getUnqual(ClassTy), Int8PtrTy, LongTy,
5907-
LongTy, LongTy, IvarListPtrTy, MethodListPtrTy, CachePtrTy,
5908-
ProtocolListPtrTy, Int8PtrTy, ClassExtensionPtrTy);
5902+
ClassTy = llvm::StructType::create(
5903+
{llvm::PointerType::getUnqual(VMContext),
5904+
llvm::PointerType::getUnqual(VMContext), Int8PtrTy, LongTy, LongTy,
5905+
LongTy, IvarListPtrTy, MethodListPtrTy, CachePtrTy, ProtocolListPtrTy,
5906+
Int8PtrTy, ClassExtensionPtrTy},
5907+
"struct._objc_class");
59095908

59105909
ClassPtrTy = llvm::PointerType::getUnqual(ClassTy);
59115910

@@ -5988,13 +5987,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
59885987
// const struct _prop_list_t * class_properties;
59895988
// }
59905989

5991-
// Holder for struct _protocol_list_t *
5992-
ProtocolListnfABITy =
5993-
llvm::StructType::create(VMContext, "struct._objc_protocol_list");
5994-
59955990
ProtocolnfABITy = llvm::StructType::create(
59965991
"struct._protocol_t", ObjectPtrTy, Int8PtrTy,
5997-
llvm::PointerType::getUnqual(ProtocolListnfABITy), MethodListnfABIPtrTy,
5992+
llvm::PointerType::getUnqual(VMContext), MethodListnfABIPtrTy,
59985993
MethodListnfABIPtrTy, MethodListnfABIPtrTy, MethodListnfABIPtrTy,
59995994
PropertyListPtrTy, IntTy, IntTy, Int8PtrPtrTy, Int8PtrTy,
60005995
PropertyListPtrTy);
@@ -6006,8 +6001,9 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
60066001
// long protocol_count; // Note, this is 32/64 bit
60076002
// struct _protocol_t *[protocol_count];
60086003
// }
6009-
ProtocolListnfABITy->setBody(LongTy,
6010-
llvm::ArrayType::get(ProtocolnfABIPtrTy, 0));
6004+
ProtocolListnfABITy = llvm::StructType::create(
6005+
{LongTy, llvm::ArrayType::get(ProtocolnfABIPtrTy, 0)},
6006+
"struct._objc_protocol_list");
60116007

60126008
// struct _objc_protocol_list*
60136009
ProtocolListnfABIPtrTy = llvm::PointerType::getUnqual(ProtocolListnfABITy);
@@ -6067,11 +6063,12 @@ ObjCNonFragileABITypesHelper::ObjCNonFragileABITypesHelper(CodeGen::CodeGenModul
60676063
// struct class_ro_t *ro;
60686064
// }
60696065

6070-
ClassnfABITy = llvm::StructType::create(VMContext, "struct._class_t");
6071-
ClassnfABITy->setBody(llvm::PointerType::getUnqual(ClassnfABITy),
6072-
llvm::PointerType::getUnqual(ClassnfABITy), CachePtrTy,
6073-
llvm::PointerType::getUnqual(ImpnfABITy),
6074-
llvm::PointerType::getUnqual(ClassRonfABITy));
6066+
ClassnfABITy = llvm::StructType::create(
6067+
{llvm::PointerType::getUnqual(VMContext),
6068+
llvm::PointerType::getUnqual(VMContext), CachePtrTy,
6069+
llvm::PointerType::getUnqual(ImpnfABITy),
6070+
llvm::PointerType::getUnqual(ClassRonfABITy)},
6071+
"struct._class_t");
60756072

60766073
// LLVM for struct _class_t *
60776074
ClassnfABIPtrTy = llvm::PointerType::getUnqual(ClassnfABITy);

clang/lib/CodeGen/MicrosoftCXXABI.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -529,31 +529,29 @@ class MicrosoftCXXABI : public CGCXXABI {
529529
if (ClassHierarchyDescriptorType)
530530
return ClassHierarchyDescriptorType;
531531
// Forward-declare RTTIClassHierarchyDescriptor to break a cycle.
532-
ClassHierarchyDescriptorType = llvm::StructType::create(
533-
CGM.getLLVMContext(), "rtti.ClassHierarchyDescriptor");
534532
llvm::Type *FieldTypes[] = {CGM.IntTy, CGM.IntTy, CGM.IntTy,
535533
getImageRelativeType(CGM.UnqualPtrTy)};
536-
ClassHierarchyDescriptorType->setBody(FieldTypes);
534+
ClassHierarchyDescriptorType =
535+
llvm::StructType::create(FieldTypes, "rtti.ClassHierarchyDescriptor");
537536
return ClassHierarchyDescriptorType;
538537
}
539538

540539
llvm::StructType *getCompleteObjectLocatorType() {
541540
if (CompleteObjectLocatorType)
542541
return CompleteObjectLocatorType;
543-
CompleteObjectLocatorType = llvm::StructType::create(
544-
CGM.getLLVMContext(), "rtti.CompleteObjectLocator");
545542
llvm::Type *FieldTypes[] = {
546543
CGM.IntTy,
547544
CGM.IntTy,
548545
CGM.IntTy,
549546
getImageRelativeType(CGM.Int8PtrTy),
550547
getImageRelativeType(CGM.UnqualPtrTy),
551-
getImageRelativeType(CompleteObjectLocatorType),
548+
getImageRelativeType(CGM.VoidTy),
552549
};
553550
llvm::ArrayRef<llvm::Type *> FieldTypesRef(FieldTypes);
554551
if (!isImageRelative())
555552
FieldTypesRef = FieldTypesRef.drop_back();
556-
CompleteObjectLocatorType->setBody(FieldTypesRef);
553+
CompleteObjectLocatorType =
554+
llvm::StructType::create(FieldTypesRef, "rtti.CompleteObjectLocator");
557555
return CompleteObjectLocatorType;
558556
}
559557

flang/lib/Optimizer/CodeGen/CodeGen.cpp

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2949,9 +2949,10 @@ struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
29492949
llvm::LogicalResult
29502950
matchAndRewrite(fir::LoadOp load, OpAdaptor adaptor,
29512951
mlir::ConversionPatternRewriter &rewriter) const override {
2952+
29522953
mlir::Type llvmLoadTy = convertObjectType(load.getType());
29532954
if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(load.getType())) {
2954-
// fir.box is a special case because it is considered as an ssa values in
2955+
// fir.box is a special case because it is considered an ssa value in
29552956
// fir, but it is lowered as a pointer to a descriptor. So
29562957
// fir.ref<fir.box> and fir.box end up being the same llvm types and
29572958
// loading a fir.ref<fir.box> is implemented as taking a snapshot of the
@@ -2960,30 +2961,17 @@ struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
29602961
mlir::Location loc = load.getLoc();
29612962
auto newBoxStorage =
29622963
genAllocaAndAddrCastWithType(loc, llvmLoadTy, defaultAlign, rewriter);
2963-
// TODO: always generate llvm.memcpy, LLVM is better at optimizing it than
2964-
// aggregate loads + stores.
2965-
if (boxTy.isAssumedRank()) {
2966-
2967-
TypePair boxTypePair{boxTy, llvmLoadTy};
2968-
mlir::Value boxSize =
2969-
computeBoxSize(loc, boxTypePair, inputBoxStorage, rewriter);
2970-
auto memcpy = rewriter.create<mlir::LLVM::MemcpyOp>(
2971-
loc, newBoxStorage, inputBoxStorage, boxSize, /*isVolatile=*/false);
2972-
if (std::optional<mlir::ArrayAttr> optionalTag = load.getTbaa())
2973-
memcpy.setTBAATags(*optionalTag);
2974-
else
2975-
attachTBAATag(memcpy, boxTy, boxTy, nullptr);
2976-
} else {
2977-
auto boxValue = rewriter.create<mlir::LLVM::LoadOp>(loc, llvmLoadTy,
2978-
inputBoxStorage);
2979-
if (std::optional<mlir::ArrayAttr> optionalTag = load.getTbaa())
2980-
boxValue.setTBAATags(*optionalTag);
2981-
else
2982-
attachTBAATag(boxValue, boxTy, boxTy, nullptr);
2983-
auto storeOp =
2984-
rewriter.create<mlir::LLVM::StoreOp>(loc, boxValue, newBoxStorage);
2985-
attachTBAATag(storeOp, boxTy, boxTy, nullptr);
2986-
}
2964+
2965+
TypePair boxTypePair{boxTy, llvmLoadTy};
2966+
mlir::Value boxSize =
2967+
computeBoxSize(loc, boxTypePair, inputBoxStorage, rewriter);
2968+
auto memcpy = rewriter.create<mlir::LLVM::MemcpyOp>(
2969+
loc, newBoxStorage, inputBoxStorage, boxSize, /*isVolatile=*/false);
2970+
2971+
if (std::optional<mlir::ArrayAttr> optionalTag = load.getTbaa())
2972+
memcpy.setTBAATags(*optionalTag);
2973+
else
2974+
attachTBAATag(memcpy, boxTy, boxTy, nullptr);
29872975
rewriter.replaceOp(load, newBoxStorage);
29882976
} else {
29892977
auto loadOp = rewriter.create<mlir::LLVM::LoadOp>(
@@ -3227,20 +3215,13 @@ struct StoreOpConversion : public fir::FIROpConversion<fir::StoreOp> {
32273215
mlir::LLVM::AliasAnalysisOpInterface newOp;
32283216
if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(storeTy)) {
32293217
mlir::Type llvmBoxTy = lowerTy().convertBoxTypeAsStruct(boxTy);
3230-
// fir.box value is actually in memory, load it first before storing it,
3231-
// or do a memcopy for assumed-rank descriptors.
3232-
if (boxTy.isAssumedRank()) {
3233-
TypePair boxTypePair{boxTy, llvmBoxTy};
3234-
mlir::Value boxSize =
3235-
computeBoxSize(loc, boxTypePair, llvmValue, rewriter);
3236-
newOp = rewriter.create<mlir::LLVM::MemcpyOp>(
3237-
loc, llvmMemref, llvmValue, boxSize, /*isVolatile=*/false);
3238-
} else {
3239-
auto val =
3240-
rewriter.create<mlir::LLVM::LoadOp>(loc, llvmBoxTy, llvmValue);
3241-
attachTBAATag(val, boxTy, boxTy, nullptr);
3242-
newOp = rewriter.create<mlir::LLVM::StoreOp>(loc, val, llvmMemref);
3243-
}
3218+
// Always use memcpy because LLVM is not as effective at optimizing
3219+
// aggregate loads/stores as it is optimizing memcpy.
3220+
TypePair boxTypePair{boxTy, llvmBoxTy};
3221+
mlir::Value boxSize =
3222+
computeBoxSize(loc, boxTypePair, llvmValue, rewriter);
3223+
newOp = rewriter.create<mlir::LLVM::MemcpyOp>(
3224+
loc, llvmMemref, llvmValue, boxSize, /*isVolatile=*/false);
32443225
} else {
32453226
newOp = rewriter.create<mlir::LLVM::StoreOp>(loc, llvmValue, llvmMemref);
32463227
}

flang/test/Fir/box.fir

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ func.func @fa(%a : !fir.ref<!fir.array<100xf32>>) {
5656
// CHECK-LABEL: define void @b1(
5757
// CHECK-SAME: ptr %[[res:.*]], ptr %[[arg0:.*]], i64 %[[arg1:.*]])
5858
func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.char<1,?>> {
59+
// CHECK: %[[alloca:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8 }
5960
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
6061
// CHECK: insertvalue {{.*}} undef, i64 %[[size]], 1
6162
// CHECK: insertvalue {{.*}} i32 20240719, 2
6263
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
6364
%x = fir.embox %arg0 typeparams %arg1 : (!fir.ref<!fir.char<1,?>>, index) -> !fir.box<!fir.char<1,?>>
64-
// CHECK: store {{.*}}, ptr %[[res]]
65+
// CHECK: store {{.*}}, ptr %[[alloca]]
66+
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[res]], ptr %[[alloca]], i32 24, i1 false)
6567
return %x : !fir.box<!fir.char<1,?>>
6668
}
6769

@@ -71,11 +73,13 @@ func.func @b1(%arg0 : !fir.ref<!fir.char<1,?>>, %arg1 : index) -> !fir.box<!fir.
7173
// CHECK-SAME: ptr %[[arg0:.*]], i64 %[[arg1:.*]])
7274
func.func @b2(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,5>>>, %arg1 : index) -> !fir.box<!fir.array<?x!fir.char<1,5>>> {
7375
%1 = fir.shape %arg1 : (index) -> !fir.shape<1>
76+
// CHECK: %[[alloca:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
7477
// 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
7578
// CHECK: insertvalue {{.*}} %{{.*}}, i64 ptrtoint (ptr getelementptr ([5 x i8], ptr null, i32 1) to i64), 7, 0, 2
7679
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
7780
%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>>>
78-
// CHECK: store {{.*}}, ptr %[[res]]
81+
// CHECK: store {{.*}}, ptr %[[alloca]]
82+
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[res]], ptr %[[alloca]], i32 48, i1 false)
7983
return %2 : !fir.box<!fir.array<?x!fir.char<1,5>>>
8084
}
8185

@@ -84,14 +88,16 @@ func.func @b2(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,5>>>, %arg1 : index) ->
8488
// CHECK-SAME: ptr %[[res:.*]], ptr %[[arg0:.*]], i64 %[[arg1:.*]], i64 %[[arg2:.*]])
8589
func.func @b3(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,?>>>, %arg1 : index, %arg2 : index) -> !fir.box<!fir.array<?x!fir.char<1,?>>> {
8690
%1 = fir.shape %arg2 : (index) -> !fir.shape<1>
91+
// CHECK: %[[alloca:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
8792
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
8893
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
8994
// CHECK: insertvalue {{.*}} i32 20240719, 2
9095
// CHECK: insertvalue {{.*}} i64 %[[arg2]], 7, 0, 1
9196
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
9297
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
9398
%2 = fir.embox %arg0(%1) typeparams %arg1 : (!fir.ref<!fir.array<?x!fir.char<1,?>>>, !fir.shape<1>, index) -> !fir.box<!fir.array<?x!fir.char<1,?>>>
94-
// CHECK: store {{.*}}, ptr %[[res]]
99+
// CHECK: store {{.*}}, ptr %[[alloca]]
100+
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[res]], ptr %[[alloca]], i32 48, i1 false)
95101
return %2 : !fir.box<!fir.array<?x!fir.char<1,?>>>
96102
}
97103

@@ -101,14 +107,16 @@ func.func @b3(%arg0 : !fir.ref<!fir.array<?x!fir.char<1,?>>>, %arg1 : index, %ar
101107
func.func @b4(%arg0 : !fir.ref<!fir.array<7x!fir.char<1,?>>>, %arg1 : index) -> !fir.box<!fir.array<7x!fir.char<1,?>>> {
102108
%c_7 = arith.constant 7 : index
103109
%1 = fir.shape %c_7 : (index) -> !fir.shape<1>
110+
// CHECK: %[[alloca:.*]] = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }
104111
// CHECK: %[[size:.*]] = mul i64 ptrtoint (ptr getelementptr (i8, ptr null, i32 1) to i64), %[[arg1]]
105112
// CHECK: insertvalue {{.*}} i64 %[[size]], 1
106113
// CHECK: insertvalue {{.*}} i32 20240719, 2
107114
// CHECK: insertvalue {{.*}} i64 7, 7, 0, 1
108115
// CHECK: insertvalue {{.*}} i64 %[[size]], 7, 0, 2
109116
// CHECK: insertvalue {{.*}} ptr %[[arg0]], 0
110117
%x = fir.embox %arg0(%1) typeparams %arg1 : (!fir.ref<!fir.array<7x!fir.char<1,?>>>, !fir.shape<1>, index) -> !fir.box<!fir.array<7x!fir.char<1,?>>>
111-
// CHECK: store {{.*}}, ptr %[[res]]
118+
// CHECK: store {{.*}}, ptr %[[alloca]]
119+
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %[[res]], ptr %[[alloca]], i32 48, i1 false)
112120
return %x : !fir.box<!fir.array<7x!fir.char<1,?>>>
113121
}
114122

@@ -117,8 +125,7 @@ func.func @b4(%arg0 : !fir.ref<!fir.array<7x!fir.char<1,?>>>, %arg1 : index) ->
117125
// CHECK-SAME: ptr %[[arg0:.*]], ptr %[[arg1:.*]])
118126
func.func @b5(%arg0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>, %arg1 : !fir.box<!fir.heap<!fir.array<?x?xf32>>>) {
119127
fir.store %arg1 to %arg0 : !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
120-
// CHECK: %[[boxLoad:.*]] = load { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] }, ptr %[[arg1]]
121-
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [2 x [3 x i64]] } %[[boxLoad]], ptr %[[arg0]]
128+
// CHECK: call void @llvm.memcpy.p0.p0.i32(ptr %0, ptr %1, i32 72, i1 false)
122129
return
123130
}
124131

flang/test/Fir/convert-to-llvm-openmp-and-fir.fir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ func.func @_QPs(%arg0: !fir.ref<complex<f32>> {fir.bindc_name = "x"}) {
799799
//CHECK: omp.parallel {
800800
//CHECK: %[[CONST_1:.*]] = llvm.mlir.constant(1 : i32) : i32
801801
//CHECK: %[[ALLOCA_1:.*]] = llvm.alloca %[[CONST_1:.*]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
802-
//CHECK: %[[LOAD:.*]] = llvm.load %[[ALLOCA]] : !llvm.ptr -> !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>
803-
//CHECK: llvm.store %[[LOAD]], %[[ALLOCA_1]] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)>, !llvm.ptr
802+
//CHECK: %[[SIZE:.*]] = llvm.mlir.constant(24 : i32) : i32
803+
//CHECK: "llvm.intr.memcpy"(%[[ALLOCA_1]], %[[ALLOCA]], %[[SIZE]]) <{isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()
804804
//CHECK: %[[GEP:.*]] = llvm.getelementptr %[[ALLOCA_1]][0, 0] : (!llvm.ptr) -> !llvm.ptr
805805
//CHECK: %[[LOAD_2:.*]] = llvm.load %[[GEP]] : !llvm.ptr -> !llvm.ptr
806806
//CHECK: omp.terminator

0 commit comments

Comments
 (0)