diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h index bee40351c4ea..9239c1a691ec 100644 --- a/llvm/include/llvm/ProfileData/InstrProf.h +++ b/llvm/include/llvm/ProfileData/InstrProf.h @@ -949,10 +949,6 @@ void InstrProfRecord::reserveSites(uint32_t ValueKind, uint32_t NumValueSites) { getOrCreateValueSitesForKind(ValueKind).reserve(NumValueSites); } -inline support::endianness getHostEndianness() { - return sys::IsLittleEndianHost ? support::little : support::big; -} - // Include definitions for value profile data #define INSTR_PROF_VALUE_PROF_DATA #include "llvm/ProfileData/InstrProfData.inc" diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h index 723df8bff528..acbc9e21fcc7 100644 --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -413,10 +413,9 @@ private: } support::endianness getDataEndianness() const { - support::endianness HostEndian = getHostEndianness(); if (!ShouldSwapBytes) - return HostEndian; - if (HostEndian == support::little) + return llvm::endianness::native; + if (llvm::endianness::native == llvm::endianness::little) return support::big; else return support::little; diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp index e82cb5c535f1..1375713cb3f8 100644 --- a/llvm/lib/ProfileData/InstrProf.cpp +++ b/llvm/lib/ProfileData/InstrProf.cpp @@ -989,7 +989,7 @@ void ValueProfRecord::swapBytes(support::endianness Old, if (Old == New) return; - if (getHostEndianness() != Old) { + if (llvm::endianness::native != Old) { sys::swapByteOrder(NumValueSites); sys::swapByteOrder(Kind); } @@ -1001,7 +1001,7 @@ void ValueProfRecord::swapBytes(support::endianness Old, sys::swapByteOrder(VD[I].Value); sys::swapByteOrder(VD[I].Count); } - if (getHostEndianness() == Old) { + if (llvm::endianness::native == Old) { sys::swapByteOrder(NumValueSites); sys::swapByteOrder(Kind); } @@ -1086,7 +1086,7 @@ ValueProfData::getValueProfData(const unsigned char *D, void ValueProfData::swapBytesToHost(support::endianness Endianness) { using namespace support; - if (Endianness == getHostEndianness()) + if (Endianness == llvm::endianness::native) return; sys::swapByteOrder(TotalSize); @@ -1094,7 +1094,7 @@ void ValueProfData::swapBytesToHost(support::endianness Endianness) { ValueProfRecord *VR = getFirstValueProfRecord(this); for (uint32_t K = 0; K < NumValueKinds; K++) { - VR->swapBytes(Endianness, getHostEndianness()); + VR->swapBytes(Endianness, llvm::endianness::native); VR = getValueProfRecordNext(VR); } } @@ -1102,13 +1102,13 @@ void ValueProfData::swapBytesToHost(support::endianness Endianness) { void ValueProfData::swapBytesFromHost(support::endianness Endianness) { using namespace support; - if (Endianness == getHostEndianness()) + if (Endianness == llvm::endianness::native) return; ValueProfRecord *VR = getFirstValueProfRecord(this); for (uint32_t K = 0; K < NumValueKinds; K++) { ValueProfRecord *NVR = getValueProfRecordNext(VR); - VR->swapBytes(getHostEndianness(), Endianness); + VR->swapBytes(llvm::endianness::native, Endianness); VR = NVR; } sys::swapByteOrder(TotalSize);