diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp index a95d9bc3b08a..f923ad2ddd9c 100644 --- a/llvm/lib/ProfileData/InstrProfReader.cpp +++ b/llvm/lib/ProfileData/InstrProfReader.cpp @@ -90,14 +90,14 @@ RawInstrProfReader::RawInstrProfReader(std::unique_ptr DataBuffer) static uint64_t getRawMagic() { return - uint64_t('l') << 56 | - uint64_t('p') << 48 | - uint64_t('r') << 40 | - uint64_t('o') << 32 | - uint64_t('f') << 24 | - uint64_t('r') << 16 | - uint64_t('a') << 8 | - uint64_t('w'); + uint64_t(255) << 56 | + uint64_t('l') << 48 | + uint64_t('p') << 40 | + uint64_t('r') << 32 | + uint64_t('o') << 24 | + uint64_t('f') << 16 | + uint64_t('r') << 8 | + uint64_t(129); } bool RawInstrProfReader::hasFormat(const MemoryBuffer &DataBuffer) { diff --git a/llvm/test/tools/llvm-profdata/Inputs/binary.profdata b/llvm/test/tools/llvm-profdata/Inputs/binary.profdata index 156c483d15f1..e8cef21de5f2 100644 Binary files a/llvm/test/tools/llvm-profdata/Inputs/binary.profdata and b/llvm/test/tools/llvm-profdata/Inputs/binary.profdata differ diff --git a/llvm/test/tools/llvm-profdata/raw-magic-but-no-header.test b/llvm/test/tools/llvm-profdata/raw-magic-but-no-header.test index e899ece2755e..6db723c3e253 100644 --- a/llvm/test/tools/llvm-profdata/raw-magic-but-no-header.test +++ b/llvm/test/tools/llvm-profdata/raw-magic-but-no-header.test @@ -1,6 +1,6 @@ -RUN: printf "warforpl" > %t +RUN: printf '\201rforpl\377' > %t RUN: not llvm-profdata show %t 2>&1 | FileCheck %s -RUN: printf "lprofraw" > %t +RUN: printf '\377lprofr\201' > %t RUN: not llvm-profdata show %t 2>&1 | FileCheck %s CHECK: error: {{.+}}: Invalid header