Skip to content

Conversation

Jezurko
Copy link
Collaborator

@Jezurko Jezurko commented Jun 2, 2025

LLVM IR currently accepts:

define void @incompatible_call_and_callee_types() {
  call void @callee(i64 0)
  ret void
}

define void @callee({ptr, i64}, i32) {
  ret void
}

This currently fails to import. Even though these constructs are dangerous and probably indicate some ODR violation (or optimization bug), they are "valid" and should be imported into LLVM IR dialect. This PR implements that by using an indirect call to represent it. Translation already works nicely and outputs the same source llvm IR file.

The error is now a warning, the tests in
mlir/test/Target/LLVMIR/Import/import-failure.ll already use CHECK lines, so no need to add extra diagnostic tests.

…ll (llvm#135895)

LLVM IR currently [accepts](https://godbolt.org/z/nqnEsW1ja):
```
define void @incompatible_call_and_callee_types() {
  call void @callee(i64 0)
  ret void
}

define void @callee({ptr, i64}, i32) {
  ret void
}
```

This currently fails to import. Even though these constructs are
dangerous and probably indicate some ODR violation (or optimization
bug), they are "valid" and should be imported into LLVM IR dialect. This
PR implements that by using an indirect call to represent it.
Translation already works nicely and outputs the same source llvm IR
file.

The error is now a warning, the tests in
`mlir/test/Target/LLVMIR/Import/import-failure.ll` already use `CHECK`
lines, so no need to add extra diagnostic tests.
@Jezurko Jezurko requested review from ekilmer and frabert June 2, 2025 08:25
@Jezurko Jezurko self-assigned this Jun 2, 2025
@Jezurko Jezurko merged commit 17ae776 into main Jun 2, 2025
7 checks passed
@Jezurko Jezurko deleted the robert/incompatible-func branch June 2, 2025 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants