[Mlir-commits] [mlir] [mlir] Add guard for using posixmemalign <= Android API 28 (PR #194263)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun Apr 26 13:03:52 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
@llvm/pr-subscribers-mlir-execution-engine
Author: cqwrteur (trcrsired)
<details>
<summary>Changes</summary>
aligned_alloc does not exist for Android before 28 too just like apple
---
Full diff: https://github.com/llvm/llvm-project/pull/194263.diff
1 Files Affected:
- (modified) mlir/lib/ExecutionEngine/CRunnerUtils.cpp (+1-1)
``````````diff
diff --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
index 41c619566b55d..272137d4b1d7c 100644
--- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -152,7 +152,7 @@ extern "C" void *mlirAlloc(uint64_t size) { return malloc(size); }
extern "C" void *mlirAlignedAlloc(uint64_t alignment, uint64_t size) {
#ifdef _WIN32
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || (defined(__ANDROID_API__) && __ANDROID_API__ <= 28)
// aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also
// support older versions.
void *result = nullptr;
``````````
</details>
https://github.com/llvm/llvm-project/pull/194263
More information about the Mlir-commits
mailing list