[Support] Add MemoryBuffer::dontNeedIfMmap
On *NIX systems, this API calls madvise(MADV_DONTNEED) on read-only file mappings. It should not be used on a writable buffer. The API is used to implement ld.lld LTO memory saving trick (D116367). Note: on read-only file mappings, Linux's MADV_DONTNEED semantics match POSIX POSIX_MADV_DONTNEED and BSD systems' MADV_DONTNEED. On Windows, VirtualAllocEx MEM_COMMIT/MEM_RESET have similar semantics but are unfortunately not drop-in replacements. dontNeedIfMmap is currently a no-op. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D116366
Loading
Please register or sign in to comment