[llvm] e62c214 - [ProfileData] Simplify calls to readNext in readBinaryIdsInternal (NFC) (#94862)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 8 14:03:33 PDT 2024
Author: Kazu Hirata
Date: 2024-06-08T14:03:30-07:00
New Revision: e62c2146aa9a195c219b3585eb36c6987857c1bb
URL: https://github.com/llvm/llvm-project/commit/e62c2146aa9a195c219b3585eb36c6987857c1bb
DIFF: https://github.com/llvm/llvm-project/commit/e62c2146aa9a195c219b3585eb36c6987857c1bb.diff
LOG: [ProfileData] Simplify calls to readNext in readBinaryIdsInternal (NFC) (#94862)
readNext has two variants:
- readNext<uint64_t, endian>(ptr)
- readNext<uint64_t>(ptr, endian)
This patch uses the latter to simplify readBinaryIdsInternal. Both
forms default to unaligned.
Added:
Modified:
llvm/lib/ProfileData/InstrProfReader.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index 27855bf92b871..54a2a61c31875 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -113,12 +113,7 @@ readBinaryIdsInternal(const MemoryBuffer &DataBuffer,
instrprof_error::malformed,
"not enough data to read binary id length");
- uint64_t BILen = 0;
- if (Endian == llvm::endianness::little)
- BILen = endian::readNext<uint64_t, llvm::endianness::little>(BI);
- else
- BILen = endian::readNext<uint64_t, llvm::endianness::big>(BI);
-
+ uint64_t BILen = endian::readNext<uint64_t>(BI, Endian);
if (BILen == 0)
return make_error<InstrProfError>(instrprof_error::malformed,
"binary id length is 0");
More information about the llvm-commits
mailing list