[Mlir-commits] [mlir] MLIR: Enable importing inlineasm calls (PR #121624)

Tobias Gysi llvmlistbot at llvm.org
Sat Jan 4 02:15:44 PST 2025


================
@@ -1579,53 +1580,65 @@ LogicalResult ModuleImport::convertInstruction(llvm::Instruction *inst) {
 
     SmallVector<Type> types;
     SmallVector<Value> operands;
-    if (failed(convertCallTypeAndOperands(callInst, types, operands)))
+    if (failed(convertCallTypeAndOperands(callInst, types, operands, true)))
       return failure();
 
     auto funcTy =
         dyn_cast<LLVMFunctionType>(convertType(callInst->getFunctionType()));
     if (!funcTy)
       return failure();
 
-    CallOp callOp;
-
-    if (llvm::Function *callee = callInst->getCalledFunction()) {
-      callOp = builder.create<CallOp>(
-          loc, funcTy, SymbolRefAttr::get(context, callee->getName()),
-          operands);
+    if (auto asmI = dyn_cast<llvm::InlineAsm>(callInst->getCalledOperand())) {
+      InlineAsmOp callOp = builder.create<InlineAsmOp>(
+          loc, funcTy.getReturnType(), operands,
+          builder.getStringAttr(asmI->getAsmString()),
+          builder.getStringAttr(asmI->getConstraintString()), nullptr, nullptr,
----------------
gysit wrote:

Can you prefix the nullptr arguments with the argument name. E.g. `/*has_side_effects=*/false` etc. 

Shouldn't we extract these extra arguments from the assembler instruction? Or at least use conservative values such as true for has side effects?

https://github.com/llvm/llvm-project/pull/121624


More information about the Mlir-commits mailing list