diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index a18650aadb6e93..97b280bb073f8f 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -872,8 +872,13 @@ void mapped_file_region::unmapImpl() { void mapped_file_region::dontNeedImpl() { assert(Mode == mapped_file_region::readonly); +#if defined(__MVS__) || defined(_AIX) + // If we don't have madvise, or it isn't beneficial, treat this as a no-op. + return; +#else if (Mapping) ::madvise(Mapping, Size, MADV_DONTNEED); +#endif } int mapped_file_region::alignment() {