[llvm] [ORC] Use MapperJITLinkMemoryManager for ReOptimizeLayerTest. (PR #163495)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 22:00:44 PDT 2025


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/163495

This is an attempted fix for https://github.com/llvm/llvm-project/issues/158270.

The issue described sounds like it may be caused by non-contiguous regions returned for separate allocations by the default memory manager. Using MapperJITLinkMemoryMnaager with a 10Mb slab size should fix the issue.

>From d456f587588cc1948c3a38ed7ffa5af6bcfbcd76 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Wed, 15 Oct 2025 15:56:28 +1100
Subject: [PATCH] [ORC] Use MapperJITLinkMemoryManager for ReOptimizeLayerTest.

This is an attempted fix for https://github.com/llvm/llvm-project/issues/158270.

The issue described sounds like it may be caused by non-contiguous regions
returned for separate allocations by the default memory manager. Using
MapperJITLinkMemoryMnaager with a 10Mb slab size should fix the issue.
---
 llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
index cd10ffe53d0f0..f35a3783394c9 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ReOptimizeLayerTest.cpp
@@ -9,6 +9,7 @@
 #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
 #include "llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h"
 #include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
+#include "llvm/ExecutionEngine/Orc/MapperJITLinkMemoryManager.h"
 #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
 #include "llvm/ExecutionEngine/Orc/ObjectTransformLayer.h"
 #include "llvm/ExecutionEngine/Orc/SelfExecutorProcessControl.h"
@@ -84,8 +85,11 @@ class ReOptimizeLayerTest : public testing::Test {
 
     ES = std::make_unique<ExecutionSession>(std::move(*EPC));
     JD = &ES->createBareJITDylib("main");
+
     ObjLinkingLayer = std::make_unique<ObjectLinkingLayer>(
-        *ES, std::make_unique<InProcessMemoryManager>(*PageSize));
+        *ES, std::make_unique<MapperJITLinkMemoryManager>(
+                 10 * 1024 * 1024,
+                 std::make_unique<InProcessMemoryMapper>(*PageSize)));
     DL = std::make_unique<DataLayout>(std::move(*DLOrErr));
 
     auto TM = JTMB->createTargetMachine();



More information about the llvm-commits mailing list