]> granicus.if.org Git - llvm/commitdiff
Fix SupportTests.exe/AllocationTests/MappedMemoryTest.AllocAndReleaseHuge when the...
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 28 Feb 2019 03:42:07 +0000 (03:42 +0000)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Thu, 28 Feb 2019 03:42:07 +0000 (03:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355067 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/Memory.inc

index 7153bf931e7d75f281c70c18c1e514dadc9f70df..0e961fdeaad1ac616ad35e6a80e38f80b0a638e7 100644 (file)
@@ -110,16 +110,16 @@ MemoryBlock Memory::allocateMappedMemory(size_t NumBytes,
     return MemoryBlock();
 
   static size_t DefaultGranularity = getAllocationGranularity();
-  static Optional<size_t> LargePageGranularity = enableProcessLargePages();
+  static size_t LargePageGranularity = enableProcessLargePages();
 
   DWORD AllocType = MEM_RESERVE | MEM_COMMIT;
   bool HugePages = false;
   size_t Granularity = DefaultGranularity;
 
-  if ((Flags & MF_HUGE_HINT) && LargePageGranularity.hasValue()) {
+  if ((Flags & MF_HUGE_HINT) && LargePageGranularity > 0) {
     AllocType |= MEM_LARGE_PAGES;
     HugePages = true;
-    Granularity = *LargePageGranularity;
+    Granularity = LargePageGranularity;
   }
 
   size_t NumBlocks = (NumBytes + Granularity - 1) / Granularity;