summaryrefslogtreecommitdiff
path: root/mlir/lib/Target/LLVMIR/LLVMImportInterface.cpp
AgeCommit message (Collapse)Author
2025-07-30Reapply "[mlir][llvm] Add intrinsic arg and result attribute support … ↵Tobias Gysi
(#151324) …(… (#151099) This reverts commit 2780b8f22058b35a8e70045858b87a1966df8df3 and relands b7bfbc0c4c7b20d6623a5b0b4a7fea8ae08a62da. Adds the following fixes compared to the original PR (https://github.com/llvm/llvm-project/pull/150783): - A bazel fix - Use `let methods` instead of `list<InterfaceMethod> methods` The missing forward declaration has been added in meantime: https://github.com/llvm/llvm-project/commit/9164d206b33d61c93f5fc4628797485f96d654ca.
2025-07-30Revert "Reland "[mlir][llvm] Add intrinsic arg and result attribute support ↵Mehdi Amini
(…" (#151316) Reverts llvm/llvm-project#151125 Broke the gcc-7 build: include/mlir/Target/LLVMIR/ModuleTranslation.h:318:34: error: no type named 'CallBase' in namespace 'llvm' llvm::CallBase *call, ~~~~~~^
2025-07-30Reland "[mlir][llvm] Add intrinsic arg and result attribute support (… ↵Tobias Gysi
(#151125) …… (#151099) This reverts commit 2780b8f22058b35a8e70045858b87a1966df8df3 to reland 59013d44058ef423a117f95092150e16e16fdb09. In addition to the original commit this one includes: - This includes a bazel fix - Use `let methods` instead of `list<InterfaceMethod> methods` The original commit message was: This patch extends the LLVM dialect's intrinsic infra to support argument and result attributes. Initial support is added for the memory intrinsics llvm.intr.memcpy, llvm.intr.memmove, and llvm.intr.memset. Additionally, an ArgAndResultAttrsOpInterface is factored out of CallOpInterface and CallableOpInterface, enabling operations to have argument and result attributes without requiring them to be a call or a callable operation.
2025-07-29Revert "[mlir][llvm] Add intrinsic arg and result attribute support (… ↵Tobias Gysi
(#151099) …#150783)" This reverts commit 59013d44058ef423a117f95092150e16e16fdb09. The change breaks a flang build bot: https://lab.llvm.org/buildbot/#/builders/207/builds/4441
2025-07-29[mlir][llvm] Add intrinsic arg and result attribute support (#150783)Tobias Gysi
This patch extends the LLVM dialect's intrinsic infra to support argument and result attributes. Initial support is added for the memory intrinsics `llvm.intr.memcpy`, `llvm.intr.memmove`, and `llvm.intr.memset`. Additionally, an ArgAndResultAttrsOpInterface is factored out of CallOpInterface and CallableOpInterface, enabling operations to have argument and result attributes without requiring them to be a call or a callable operation.
2025-07-22[mlir][NFC] update `mlir/lib` create APIs (26/n) (#149933)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info. --------- Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2025-07-05[mlir] Remove unused includes (NFC) (#147158)Kazu Hirata
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-05-05[MLIR][LLVM] Importer: fix void returning intrinsic calls (#138325)Bruno Cardoso Lopes
2025-03-14[MLIR][LLVMIR] Import: add flag to prefer using unregistered intrinsics ↵Bruno Cardoso Lopes
(#130685) Currently, there is no common mechanism for supported intrinsics to be generically annotated with arg and ret attributes. Since there are many supported intrinsics around different dialects, the amount of work to teach all them about these attributes is not trivial (though it would be nice in the long term). This PR adds a new flag `-prefer-unregistered-intrinsics` that can be used alongside `--import-llvm` to always use `llvm.intrinsic_call` during import time (ignoring dialect hooks for custom intrinsic support). Using this flag allow us to roundtrip the LLVM IR while eliminating a whole set of differences coming from lack of arg/ret attributes on supported intrinsics. Note `convertIntrinsic` has to be moved to an implementation file because it queries into `moduleImport` state, which is a fwd declaration in `LLVMImportInterface.h`
2025-03-05[MLIR][LLVMIR] llvm.call_intrinsic: support operand/result attributes (#129640)Bruno Cardoso Lopes
Basically catch up with llvm.call and add support for translate and import to LLVM IR. This PR is split into two commits in case it's easier to review the refactoring part, which comes first (happy to split the PR if necessary). --------- Co-authored-by: Tobias Gysi <tobias.gysi@nextsilicon.com>
2025-03-02Reapply [MLIR][LLVMIR] Import unregistered intrinsics via llvm.intrin… ↵Bruno Cardoso Lopes
(#129174) …sic_call Original introduced in https://github.com/llvm/llvm-project/pull/128626, reverted in https://github.com/llvm/llvm-project/pull/128973 Reproduced the issue on a shared lib build locally on Linux, moved content around to satisfy both static and shared lib builds. ### Original commit message Currently, the llvm importer can only cover intrinsics that have a first class representation in an MLIR dialect (arm-neon, etc). This PR introduces a fallback mechanism that allow "unregistered" intrinsics to be imported by using the generic `llvm.intrinsic_call` operation. This is useful in several ways: 1. Allows round-trip the LLVM dialect output lowered from other dialects (example: ClangIR) 2. Enables MLIR-linking tools to operate on imported LLVM IR without requiring to add new operations to dozen of different targets. If multiple dialects implement this interface hook, the last one to register is the one converting all unregistered intrinsics. --------- Co-authored-by: Bruno Cardoso Lopes <bcardosolopes@users.noreply.github.com>