diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2024-02-05 14:16:05 +0900 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2024-02-05 15:04:57 +0900 |
commit | f035c018a6a581c38680651d4856631d9c6ccb0a (patch) | |
tree | c0f332c003c31554a55b16667ebac7acf5593fc7 /llvm/lib/ProfileData | |
parent | a9670fb0de1cb87fb1556e8cf28d528171f5bd9b (diff) | |
download | llvm-f035c018a6a581c38680651d4856631d9c6ccb0a.zip llvm-f035c018a6a581c38680651d4856631d9c6ccb0a.tar.gz llvm-f035c018a6a581c38680651d4856631d9c6ccb0a.tar.bz2 |
InstrProf::getFunctionBitmap: Fix BE hosts (#80608)
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r-- | llvm/lib/ProfileData/InstrProfReader.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index 773bfe5..0d8d43d 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -1446,12 +1446,15 @@ Error IndexedInstrProfReader::getFunctionBitmap(StringRef FuncName, size_t I = 0, E = BitmapBytes.size(); Bitmap.resize(E * CHAR_BIT); BitVector::apply( - [&](auto x) { - decltype(x) W = 0; + [&](auto X) { + using XTy = decltype(X); + alignas(XTy) uint8_t W[sizeof(X)]; size_t N = std::min(E - I, sizeof(W)); - std::memcpy((void *)&W, &BitmapBytes[I], N); + std::memset(W, 0, sizeof(W)); + std::memcpy(W, &BitmapBytes[I], N); I += N; - return W; + return support::endian::read<XTy, llvm::endianness::little, + support::aligned>(W); }, Bitmap, Bitmap); assert(I == E); |