Index: mlir/lib/Target/LLVMIR/ModuleTranslation.cpp =================================================================== --- mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -1105,7 +1105,8 @@ if (!argTy.isa()) return func.emitError( "llvm.sret attribute attached to LLVM non-pointer argument"); - llvmArg.addAttr(llvm::Attribute::AttrKind::StructRet); + llvmArg.addAttrs(llvm::AttrBuilder().addStructRetAttr( + llvmArg.getType()->getPointerElementType())); } if (auto attr = func.getArgAttrOfType(argIdx, "llvm.byval")) { @@ -1113,7 +1114,8 @@ if (!argTy.isa()) return func.emitError( "llvm.byval attribute attached to LLVM non-pointer argument"); - llvmArg.addAttr(llvm::Attribute::AttrKind::ByVal); + llvmArg.addAttrs(llvm::AttrBuilder().addByValAttr( + llvmArg.getType()->getPointerElementType())); } valueMapping[mlirArg] = &llvmArg;