[Mlir-commits] [mlir] [MLIR] Fix import of calls with mismatched variadic types (PR #124286)

Henrich Lauko llvmlistbot at llvm.org
Fri Jan 24 07:27:18 PST 2025


xlauko wrote:

Previously, the translation for the following LLVM IR:  
```llvm
define i32 @bar() {
entry:
  %call = call i32 @foo()
  ret i32 %call
}

declare i32 @foo(...)
```

was generating an indirect call like this in MLIR:  
```mlir
llvm.func @bar() -> i32 {
    %0 = llvm.mlir.addressof @foo : !llvm.ptr
    %1 = llvm.call %0() : !llvm.ptr, () -> i32
    llvm.return %1 : i32
}
llvm.func @foo(...) -> i32
```

However, this translation was incorrect. The fixed translation now generates the correct MLIR:  
```mlir
llvm.func @bar() -> i32 {
    %0 = llvm.call @foo() vararg(!llvm.func<i32 (...)>) : () -> i32
    llvm.return %0 : i32
}
llvm.func @foo(...) -> i32
```

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


More information about the Mlir-commits mailing list