[llvm] 7df8821 - [ProfileData] Use llvm::byteswap instead of sys::getSwappedBytes (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 23 13:00:53 PDT 2023


Author: Kazu Hirata
Date: 2023-09-23T13:00:47-07:00
New Revision: 7df88212d43acd90b2fdd01e730375bcb238c6b5

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

LOG: [ProfileData] Use llvm::byteswap instead of sys::getSwappedBytes (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/ProfileData/InstrProfCorrelator.h
    llvm/include/llvm/ProfileData/InstrProfReader.h
    llvm/lib/ProfileData/InstrProfReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ProfileData/InstrProfCorrelator.h b/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
index 9050173269283bb..1c0a0d8d0cddfba 100644
--- a/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
+++ b/llvm/include/llvm/ProfileData/InstrProfCorrelator.h
@@ -161,7 +161,7 @@ class InstrProfCorrelatorImpl : public InstrProfCorrelator {
 
   // Byte-swap the value if necessary.
   template <class T> T maybeSwap(T Value) const {
-    return Ctx->ShouldSwapBytes ? sys::getSwappedBytes(Value) : Value;
+    return Ctx->ShouldSwapBytes ? llvm::byteswap(Value) : Value;
   }
 };
 

diff  --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h
index 74e921e10c47b9a..faf91e017756da9 100644
--- a/llvm/include/llvm/ProfileData/InstrProfReader.h
+++ b/llvm/include/llvm/ProfileData/InstrProfReader.h
@@ -409,7 +409,7 @@ class RawInstrProfReader : public InstrProfReader {
   Error readHeader(const RawInstrProf::Header &Header);
 
   template <class IntT> IntT swap(IntT Int) const {
-    return ShouldSwapBytes ? sys::getSwappedBytes(Int) : Int;
+    return ShouldSwapBytes ? llvm::byteswap(Int) : Int;
   }
 
   support::endianness getDataEndianness() const {

diff  --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index db20441b712cd24..9375678f8046167 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -471,7 +471,7 @@ bool RawInstrProfReader<IntPtrT>::hasFormat(const MemoryBuffer &DataBuffer) {
   uint64_t Magic =
     *reinterpret_cast<const uint64_t *>(DataBuffer.getBufferStart());
   return RawInstrProf::getMagic<IntPtrT>() == Magic ||
-         sys::getSwappedBytes(RawInstrProf::getMagic<IntPtrT>()) == Magic;
+         llvm::byteswap(RawInstrProf::getMagic<IntPtrT>()) == Magic;
 }
 
 template <class IntPtrT>


        


More information about the llvm-commits mailing list