[Mlir-commits] [llvm] [mlir] [mlir][LLVM] handle argument and result attributes in llvm.call and llvm.invoke (PR #123177)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Feb 10 06:51:10 PST 2025
================
@@ -224,6 +224,34 @@ static void convertLinkerOptionsOp(ArrayAttr options,
linkerMDNode->addOperand(listMDNode);
}
+static LogicalResult
+convertParameterAndResultAttrs(CallOpInterface callOp, llvm::CallBase *call,
+ LLVM::ModuleTranslation &moduleTranslation) {
+ if (ArrayAttr argAttrsArray = callOp.getArgAttrsAttr()) {
+ for (auto [argIdx, argAttrsAttr] : llvm::enumerate(argAttrsArray)) {
+ if (auto argAttrs = llvm::cast<DictionaryAttr>(argAttrsAttr)) {
+ FailureOr<llvm::AttrBuilder> attrBuilder =
+ moduleTranslation.convertParameterAttrs(argAttrs);
+ if (failed(attrBuilder))
+ return failure();
+ call->addParamAttrs(argIdx, *attrBuilder);
+ }
+ }
+ }
+
+ ArrayAttr resAttrsArray = callOp.getResAttrsAttr();
+ if (resAttrsArray && resAttrsArray.size() == 1) {
----------------
jeanPerier wrote:
Updated to return a failure.
https://github.com/llvm/llvm-project/pull/123177
More information about the Mlir-commits
mailing list