[llvm] 22b36bf - [Memprof] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 26 12:06:04 PDT 2024


Author: Kazu Hirata
Date: 2024-06-26T12:05:58-07:00
New Revision: 22b36bfa3f18ef1cc858d3301c4eea00a280403a

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

LOG: [Memprof] Fix a warning

This patch fixes:

  llvm/lib/ProfileData/MemProfReader.cpp:685:1: error: non-void
  function does not return a value in all con trol paths
  [-Werror,-Wreturn-type]

While I am at it, this patch removes an else-after-return.

Added: 
    

Modified: 
    llvm/lib/ProfileData/MemProfReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/MemProfReader.cpp b/llvm/lib/ProfileData/MemProfReader.cpp
index 9112e19982eca6..85327273d6d7b0 100644
--- a/llvm/lib/ProfileData/MemProfReader.cpp
+++ b/llvm/lib/ProfileData/MemProfReader.cpp
@@ -677,11 +677,10 @@ llvm::SmallVector<std::pair<uint64_t, MemInfoBlock>>
 RawMemProfReader::readMemInfoBlocks(const char *Ptr) {
   if (MemprofRawVersion == 3ULL)
     return readMemInfoBlocksV3(Ptr);
-  else if (MemprofRawVersion == 4ULL)
+  if (MemprofRawVersion == 4ULL)
     return readMemInfoBlocksV4(Ptr);
-  else
-    assert(false &&
-           "Panic: Unsupported version number when reading MemInfoBlocks");
+  llvm_unreachable(
+      "Panic: Unsupported version number when reading MemInfoBlocks");
 }
 
 Error RawMemProfReader::readRawProfile(


        


More information about the llvm-commits mailing list