[mlir] Add guard for using posixmemalign <= Android API 28 #194263
<!--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:
````````````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>
maybe update the comment too?
Approved these changes.
ok
done
Approved these changes.
when to merge? thanks
enh-google
trcrsired
aligned_alloc does not exist for Android before 28 too just like apple