[Mlir-commits] [mlir] [mlir] Use add_tablegen() for mlir-src-sharder to fix aarch64 cross-compile (PR #196202)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 6 15:51:48 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Diksha (diksha)
<details>
<summary>Changes</summary>
## Summary
`add_tablegen()` already sets `MLIR_SRC_SHARDER_TABLEGEN_EXE` to the native host-tool path during cross-compilation (via `build_native_tool`). The leftover manual `set(MLIR_SRC_SHARDER_TABLEGEN_EXE mlir-src-sharder PARENT_SCOPE)` clobbered that path with the bare binary name, causing aarch64 cross-builds to fail with:
```
/bin/sh: 1: mlir-src-sharder: not found
```
when sharding `TestOps`. Switching `mlir-src-sharder` from `add_llvm_executable` to `add_tablegen` (and dropping the redundant `set(... PARENT_SCOPE)`) lets the existing cross-compile machinery point consumers at the host build of the tool.
## Test plan
- [ ] aarch64 cross-build of MLIR succeeds (TestOps sharding step finds the host `mlir-src-sharder`)
- [ ] Native x86_64 build still produces and uses `mlir-src-sharder` correctly
---
Full diff: https://github.com/llvm/llvm-project/pull/196202.diff
1 Files Affected:
- (modified) mlir/tools/mlir-src-sharder/CMakeLists.txt (+2-3)
``````````diff
diff --git a/mlir/tools/mlir-src-sharder/CMakeLists.txt b/mlir/tools/mlir-src-sharder/CMakeLists.txt
index ba78dad1c87b5..bc4a11bd4c0cb 100644
--- a/mlir/tools/mlir-src-sharder/CMakeLists.txt
+++ b/mlir/tools/mlir-src-sharder/CMakeLists.txt
@@ -1,11 +1,10 @@
set(LLVM_LINK_COMPONENTS Support)
set(LIBS MLIRSupport)
-add_llvm_executable(mlir-src-sharder mlir-src-sharder.cpp)
+add_tablegen(mlir-src-sharder MLIR_SRC_SHARDER
+ mlir-src-sharder.cpp)
set_target_properties(mlir-src-sharder PROPERTIES FOLDER "MLIR/Tablegenning")
target_link_libraries(mlir-src-sharder PRIVATE ${LIBS})
-set(MLIR_SRC_SHARDER_TABLEGEN_EXE mlir-src-sharder PARENT_SCOPE)
-
mlir_check_all_link_libraries(mlir-src-sharder)
``````````
</details>
https://github.com/llvm/llvm-project/pull/196202
More information about the Mlir-commits
mailing list