[llvm] b2f34d6 - [AIX][z/OS][Support] Provide alternate no-op mapped_file_region::dontNeedImpl implementation

David Tenty via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 07:21:13 PST 2022


Author: David Tenty
Date: 2022-01-05T10:21:01-05:00
New Revision: b2f34d6af1b814734518539542dbae5b599b0ef3

URL: https://github.com/llvm/llvm-project/commit/b2f34d6af1b814734518539542dbae5b599b0ef3
DIFF: https://github.com/llvm/llvm-project/commit/b2f34d6af1b814734518539542dbae5b599b0ef3.diff

LOG: [AIX][z/OS][Support] Provide alternate no-op mapped_file_region::dontNeedImpl implementation

mapped_file_region::dontNeedImpl added in D116366 calls madvise, which
causes problems for z/OS and AIX.

For z/OS, we don't have either madvise, so treat this as a no-op, same
as Windows does.

For AIX, it doesn't have any effect, doesn't have a standardized
signature, and it needs certain feature test macros (i.e. _ALL_SOURCE)
we don't set by default for LLVM on AIX, so just make it a no-op too.

Differential Revision: https://reviews.llvm.org/D116603

Added: 
    

Modified: 
    llvm/lib/Support/Unix/Path.inc

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index a18650aadb6e9..97b280bb073f8 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() {


        


More information about the llvm-commits mailing list