[llvm] b3b940d - Remove unnecessary comparison.

Mitch Phillips via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 15:05:42 PST 2023


Author: Mitch Phillips
Date: 2023-02-01T15:04:06-08:00
New Revision: b3b940d1501e39563ac549c3a5a89b25ae8ab7b8

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

LOG: Remove unnecessary comparison.

Popped up after https://reviews.llvm.org/D142826 added extra flags to
-Wextra, which is used by our sanitizer buildbots
(https://lab.llvm.org/buildbot/#/builders/37/builds/19910).

This check seems unnecessary, it's a bad cargo-cult after the buffer
size was expanded to allow >= 4GiB after
https://reviews.llvm.org/rGd6c15b661ab0aabb00f1219ce4af7136938e67e2.

Added: 
    

Modified: 
    llvm/lib/ProfileData/InstrProfReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 498ec69104405..615e5c4b36dc6 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -226,9 +226,6 @@ IndexedInstrProfReader::create(const Twine &Path, vfs::FileSystem &FS,
 Expected<std::unique_ptr<IndexedInstrProfReader>>
 IndexedInstrProfReader::create(std::unique_ptr<MemoryBuffer> Buffer,
                                std::unique_ptr<MemoryBuffer> RemappingBuffer) {
-  if (uint64_t(Buffer->getBufferSize()) > std::numeric_limits<uint64_t>::max())
-    return make_error<InstrProfError>(instrprof_error::too_large);
-
   // Create the reader.
   if (!IndexedInstrProfReader::hasFormat(*Buffer))
     return make_error<InstrProfError>(instrprof_error::bad_magic);


        


More information about the llvm-commits mailing list