[Mlir-commits] [llvm] [mlir] [mlir][LLVM] handle argument and result attributes in llvm.call and llvm.invoke (PR #123177)
Christian Ulmann
llvmlistbot at llvm.org
Sun Feb 9 23:22:03 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) {
----------------
Dinistro wrote:
Nit: Maybe returning a failure or even just asserting when the size is not equal to 1 might be sensible.
https://github.com/llvm/llvm-project/pull/123177
More information about the Mlir-commits
mailing list