summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Smith <brad@comstyle.com>2022-09-09 20:33:30 -0400
committerTobias Hieta <tobias@hieta.se>2022-09-12 12:54:35 +0200
commitc643956d69b1813cc2caf938207f073d28b7b72c (patch)
treed0fcfac567ea7e430479c4513d7c93974c097fe3
parent1a5c5e0f67be2e08c86b754da1e008f645d49c61 (diff)
downloadllvm-c643956d69b1813cc2caf938207f073d28b7b72c.tar.gz
[mlir] Fix building CRunnerUtils on OpenBSD with 15.x
CRunnerUtils builds as C++11. 9c1d133c3a0256cce7f40e2e06966f84e8b99ffe broke the build on OpenBSD. aligned_alloc() was only introduced in C++17.
-rw-r--r--mlir/lib/ExecutionEngine/CRunnerUtils.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
index f2a43a5de95f..323e6d5b5187 100644
--- a/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ b/mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -127,14 +127,10 @@ extern "C" void *_mlir_alloc(uint64_t size) { return malloc(size); }
extern "C" void *_mlir_aligned_alloc(uint64_t alignment, uint64_t size) {
#ifdef _WIN32
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
- // aligned_alloc was added in MacOS 10.15. Fall back to posix_memalign to also
- // support older versions.
+#else
void *result = nullptr;
(void)::posix_memalign(&result, alignment, size);
return result;
-#else
- return aligned_alloc(alignment, size);
#endif
}