[PATCH] D116582: Remove the 4GB size check for sample profiles.

Krzysztof Pszeniczny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 4 06:08:10 PST 2022


amharc created this revision.
Herald added subscribers: wenlei, hiraditya.
amharc published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

There are legitimate usecases for >4GB profiles and this check doesn't
bring much value.

The counterpart for instrumented profiles has been previously removed in
https://github.com/llvm/llvm-project/commit/d6c15b661ab0aabb00f1219ce4af7136938e67e2.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116582

Files:
  llvm/include/llvm/ProfileData/SampleProf.h
  llvm/lib/ProfileData/SampleProf.cpp
  llvm/lib/ProfileData/SampleProfReader.cpp


Index: llvm/lib/ProfileData/SampleProfReader.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProfReader.cpp
+++ llvm/lib/ProfileData/SampleProfReader.cpp
@@ -1761,16 +1761,7 @@
 /// \returns an error code indicating the status of the buffer.
 static ErrorOr<std::unique_ptr<MemoryBuffer>>
 setupMemoryBuffer(const Twine &Filename) {
-  auto BufferOrErr = MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
-  if (std::error_code EC = BufferOrErr.getError())
-    return EC;
-  auto Buffer = std::move(BufferOrErr.get());
-
-  // Check the file.
-  if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<uint32_t>::max())
-    return sampleprof_error::too_large;
-
-  return std::move(Buffer);
+  return MemoryBuffer::getFileOrSTDIN(Filename, /*IsText=*/true);
 }
 
 /// Create a sample profile reader based on the format of the input file.
Index: llvm/lib/ProfileData/SampleProf.cpp
===================================================================
--- llvm/lib/ProfileData/SampleProf.cpp
+++ llvm/lib/ProfileData/SampleProf.cpp
@@ -70,8 +70,6 @@
       return "Invalid sample profile data (bad magic)";
     case sampleprof_error::unsupported_version:
       return "Unsupported sample profile format version";
-    case sampleprof_error::too_large:
-      return "Too much profile data";
     case sampleprof_error::truncated:
       return "Truncated profile data";
     case sampleprof_error::malformed:
Index: llvm/include/llvm/ProfileData/SampleProf.h
===================================================================
--- llvm/include/llvm/ProfileData/SampleProf.h
+++ llvm/include/llvm/ProfileData/SampleProf.h
@@ -46,7 +46,6 @@
   success = 0,
   bad_magic,
   unsupported_version,
-  too_large,
   truncated,
   malformed,
   unrecognized_format,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116582.397219.patch
Type: text/x-patch
Size: 1826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/6dfa0c22/attachment.bin>


More information about the llvm-commits mailing list