File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1105,15 +1105,17 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
1105
1105
if (!argTy.isa <LLVM::LLVMPointerType>())
1106
1106
return func.emitError (
1107
1107
" llvm.sret attribute attached to LLVM non-pointer argument" );
1108
- llvmArg.addAttr (llvm::Attribute::AttrKind::StructRet);
1108
+ llvmArg.addAttrs (llvm::AttrBuilder ().addStructRetAttr (
1109
+ llvmArg.getType ()->getPointerElementType ()));
1109
1110
}
1110
1111
1111
1112
if (auto attr = func.getArgAttrOfType <UnitAttr>(argIdx, " llvm.byval" )) {
1112
1113
auto argTy = mlirArg.getType ();
1113
1114
if (!argTy.isa <LLVM::LLVMPointerType>())
1114
1115
return func.emitError (
1115
1116
" llvm.byval attribute attached to LLVM non-pointer argument" );
1116
- llvmArg.addAttr (llvm::Attribute::AttrKind::ByVal);
1117
+ llvmArg.addAttrs (llvm::AttrBuilder ().addByValAttr (
1118
+ llvmArg.getType ()->getPointerElementType ()));
1117
1119
}
1118
1120
1119
1121
valueMapping[mlirArg] = &llvmArg;
Original file line number Diff line number Diff line change @@ -939,6 +939,16 @@ llvm.func @llvm_noalias(%arg0: !llvm.ptr<f32> {llvm.noalias = true}) {
939
939
llvm.return
940
940
}
941
941
942
+ // CHECK-LABEL: define void @byvalattr(i32* byval(i32) %
943
+ llvm.func @byvalattr (%arg0: !llvm.ptr <i32 > {llvm.byval }) {
944
+ llvm.return
945
+ }
946
+
947
+ // CHECK-LABEL: define void @sretattr(i32* sret(i32) %
948
+ llvm.func @sretattr (%arg0: !llvm.ptr <i32 > {llvm.sret }) {
949
+ llvm.return
950
+ }
951
+
942
952
// CHECK-LABEL: define void @llvm_align(float* align 4 {{%*.}})
943
953
llvm.func @llvm_align (%arg0: !llvm.ptr <f32 > {llvm.align = 4 }) {
944
954
llvm.return
You can’t perform that action at this time.
0 commit comments