diff --git a/compiler-rt/lib/profile/InstrProfilingBuffer.c b/compiler-rt/lib/profile/InstrProfilingBuffer.c --- a/compiler-rt/lib/profile/InstrProfilingBuffer.c +++ b/compiler-rt/lib/profile/InstrProfilingBuffer.c @@ -107,7 +107,8 @@ uint64_t *PaddingBytesAfterNames) { if (!needsCounterPadding()) { *PaddingBytesBeforeCounters = 0; - *PaddingBytesAfterCounters = 0; + *PaddingBytesAfterCounters = + __llvm_profile_get_num_padding_bytes(CountersSize); *PaddingBytesAfterNames = __llvm_profile_get_num_padding_bytes(NamesSize); return; } diff --git a/compiler-rt/test/profile/instrprof-entry-coverage.c b/compiler-rt/test/profile/instrprof-entry-coverage.c --- a/compiler-rt/test/profile/instrprof-entry-coverage.c +++ b/compiler-rt/test/profile/instrprof-entry-coverage.c @@ -3,11 +3,17 @@ // RUN: llvm-profdata merge -o %t.profdata %t.profraw // RUN: llvm-profdata show --covered %t.profdata | FileCheck %s --implicit-check-not goo +// RUN: cat %t.profraw %t.profraw > %t2.profraw +// RUN: llvm-profdata merge -o %t.profdata %t2.profraw + // RUN: %clang_cspgogen -O1 -mllvm -pgo-function-entry-coverage %s -o %t.cs.out // RUN: env LLVM_PROFILE_FILE=%t.csprofraw %run %t.cs.out // RUN: llvm-profdata merge -o %t.csprofdata %t.csprofraw // RUN: llvm-profdata show --covered %t.csprofdata --showcs | FileCheck %s --implicit-check-not goo +// RUN: cat %t.csprofraw %t.csprofraw > %t2.csprofraw +// RUN: llvm-profdata merge -o %t.csprofdata %t2.csprofraw + void markUsed(int a) { volatile int g; g = a;