[llvm] [ProfileData] Simplify calls to readNext in readBinaryIdsInternal (NFC) (PR #94862)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 8 09:19:41 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/94862.diff
1 Files Affected:
- (modified) llvm/lib/ProfileData/InstrProfReader.cpp (+1-6)
``````````diff
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");
``````````
</details>
https://github.com/llvm/llvm-project/pull/94862
More information about the llvm-commits
mailing list