[Mlir-commits] [mlir] [mlir][LLVMIR] Add IFuncOp to LLVM dialect (PR #147697)

Tobias Gysi llvmlistbot at llvm.org
Wed Jul 9 12:50:22 PDT 2025


================
@@ -422,9 +422,18 @@ convertOperationImpl(Operation &opInst, llvm::IRBuilderBase &builder,
     ArrayRef<llvm::Value *> operandsRef(operands);
     llvm::CallInst *call;
     if (auto attr = callOp.getCalleeAttr()) {
-      call =
-          builder.CreateCall(moduleTranslation.lookupFunction(attr.getValue()),
-                             operandsRef, opBundles);
+      if (llvm::Function *function =
+              moduleTranslation.lookupFunction(attr.getValue())) {
+        call = builder.CreateCall(function, operandsRef, opBundles);
+      } else {
+        Operation *module = parentLLVMModule(&opInst);
----------------
gysit wrote:

```suggestion
        Operation *moduleOp = parentLLVMModule(&opInst);
```
nit: Let's use module op to avoid the red color.

I wonder if it would make sense if LLVM::CallOp would have a getFunction / getIFunc helper similar to the addressOf operation. But I suspect this would likely be the only use here?

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


More information about the Mlir-commits mailing list