Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ProfileData] Simplify calls to readNext in readBinaryIdsInternal (NFC) #94862

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

kazutakahirata
Copy link
Contributor

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.

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.
@llvmbot llvmbot added the PGO Profile Guided Optimizations label Jun 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jun 8, 2024

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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");

@kazutakahirata kazutakahirata merged commit e62c214 into llvm:main Jun 8, 2024
9 checks passed
@kazutakahirata kazutakahirata deleted the profiledata_readNext branch June 8, 2024 21:03
nekoshirro pushed a commit to nekoshirro/Alchemist-LLVM that referenced this pull request Jun 9, 2024
…C) (llvm#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.

Signed-off-by: Hafidz Muzakky <ais.muzakky@gmail.com>
@HerrCai0907 HerrCai0907 mentioned this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants