From 415607e10b56d0e6c4661ff1ec5b9b46bf433cba Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Thu, 13 Feb 2025 14:56:55 -0800 Subject: [PATCH] [ORC][unittests] Remove hard coded 16k page size (#127115) Fixes a couple hard coded 16k values which is being used as the page size. Replaces the hard coded value with the system's page size. This fixes #116753 on an Ampere Altra Q64-22 CC @lhames --- .../Orc/JITLinkRedirectionManagerTest.cpp | 10 ++++++++-- .../ExecutionEngine/Orc/ReOptimizeLayerTest.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp index 4b8a3efe680f1..a57241b8a3da6 100644 --- a/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/JITLinkRedirectionManagerTest.cpp @@ -48,12 +48,18 @@ class JITLinkRedirectionManagerTest : public testing::Test { if (Triple.isPPC()) GTEST_SKIP(); + auto PageSize = sys::Process::getPageSize(); + if (!PageSize) { + consumeError(PageSize.takeError()); + GTEST_SKIP(); + } + ES = std::make_unique( std::make_unique( - nullptr, nullptr, JTMB->getTargetTriple().getTriple())); + nullptr, nullptr, JTMB->getTargetTriple().getTriple(), *PageSize)); JD = &ES->createBareJITDylib("main"); ObjLinkingLayer = std::make_unique( - *ES, std::make_unique(16384)); + *ES, std::make_unique(*PageSize)); DL = std::make_unique(std::move(*DLOrErr)); } JITDylib *JD{nullptr}; diff --git a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp index 083a924ce9aa1..991b12def55fa 100644 --- a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp @@ -66,10 +66,17 @@ class ReOptimizeLayerTest : public testing::Test { consumeError(DLOrErr.takeError()); GTEST_SKIP(); } + + auto PageSize = sys::Process::getPageSize(); + if (!PageSize) { + consumeError(PageSize.takeError()); + GTEST_SKIP(); + } + ES = std::make_unique(std::move(*EPC)); JD = &ES->createBareJITDylib("main"); ObjLinkingLayer = std::make_unique( - *ES, std::make_unique(16384)); + *ES, std::make_unique(*PageSize)); DL = std::make_unique(std::move(*DLOrErr)); auto TM = JTMB->createTargetMachine();