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

Tobias Gysi llvmlistbot at llvm.org
Fri Jul 11 12:13:03 PDT 2025


================
@@ -0,0 +1,80 @@
+; RUN: mlir-translate --import-llvm %s --split-input-file | FileCheck %s
+
+; CHECK: llvm.mlir.ifunc external @foo : !llvm.func<void (ptr, i32)>, !llvm.ptr @resolve_foo {dso_local}
+ at foo = dso_local ifunc void (ptr, i32), ptr @resolve_foo
+
+define dso_local void @call_foo(ptr noundef %0, i32 noundef %1) {
+  %3 = alloca ptr, align 8
+  %4 = alloca i32, align 4
+  store ptr %0, ptr %3, align 8
+  store i32 %1, ptr %4, align 4
+  %5 = load ptr, ptr %3, align 8
+  %6 = load i32, ptr %4, align 4
+; CHECK: llvm.call @foo
+  call void @foo(ptr noundef %5, i32 noundef %6)
+  ret void
+}
----------------
gysit wrote:

```suggestion
define dso_local void @call_foo(ptr noundef %0, i32 noundef %1) {
; CHECK: llvm.call @foo
  call void @foo(ptr noundef %0, i32 noundef %1)
  ret void
}
```
nit: I would shorten this one.

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


More information about the Mlir-commits mailing list