8 changes: 3 additions & 5 deletions compiler-rt/lib/profile/InstrProfilingInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
uint64_t __llvm_profile_get_size_for_buffer_internal(
const __llvm_profile_data *DataBegin, const __llvm_profile_data *DataEnd,
const char *CountersBegin, const char *CountersEnd, const char *BitmapBegin,
const char *BitmapEnd, const char *NamesBegin, const char *NamesEnd);
const char *CountersBegin, const char *CountersEnd, const char *NamesBegin,
const char *NamesEnd);

/*!
* \brief Write instrumentation data to the given buffer, given explicit
Expand All @@ -36,8 +36,7 @@ uint64_t __llvm_profile_get_size_for_buffer_internal(
int __llvm_profile_write_buffer_internal(
char *Buffer, const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd, const char *CountersBegin,
const char *CountersEnd, const char *BitmapBegin, const char *BitmapEnd,
const char *NamesBegin, const char *NamesEnd);
const char *CountersEnd, const char *NamesBegin, const char *NamesEnd);

/*!
* The data structure describing the data to be written by the
Expand Down Expand Up @@ -154,7 +153,6 @@ int lprofWriteDataImpl(ProfDataWriter *Writer,
const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd,
const char *CountersBegin, const char *CountersEnd,
const char *BitmapBegin, const char *BitmapEnd,
VPDataReaderType *VPDataReader, const char *NamesBegin,
const char *NamesEnd, int SkipNameDataWrite);

Expand Down
33 changes: 4 additions & 29 deletions compiler-rt/lib/profile/InstrProfilingMerge.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
Header->NumCounters !=
__llvm_profile_get_num_counters(__llvm_profile_begin_counters(),
__llvm_profile_end_counters()) ||
Header->NumBitmapBytes !=
__llvm_profile_get_num_bitmap_bytes(__llvm_profile_begin_bitmap(),
__llvm_profile_end_bitmap()) ||
Header->NamesSize != (uint64_t)(__llvm_profile_end_names() -
__llvm_profile_begin_names()) ||
Header->ValueKindLast != IPVK_Last)
Expand All @@ -77,17 +74,15 @@ int __llvm_profile_check_compatibility(const char *ProfileData,
if (ProfileSize <
sizeof(__llvm_profile_header) + Header->BinaryIdsSize +
Header->NumData * sizeof(__llvm_profile_data) + Header->NamesSize +
Header->NumCounters * __llvm_profile_counter_entry_size() +
Header->NumBitmapBytes)
Header->NumCounters * __llvm_profile_counter_entry_size())
return 1;

for (SrcData = SrcDataStart,
DstData = (__llvm_profile_data *)__llvm_profile_begin_data();
SrcData < SrcDataEnd; ++SrcData, ++DstData) {
if (SrcData->NameRef != DstData->NameRef ||
SrcData->FuncHash != DstData->FuncHash ||
SrcData->NumCounters != DstData->NumCounters ||
SrcData->NumBitmapBytes != DstData->NumBitmapBytes)
SrcData->NumCounters != DstData->NumCounters)
return 1;
}

Expand Down Expand Up @@ -117,11 +112,9 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
char *SrcCountersStart, *DstCounter;
const char *SrcCountersEnd, *SrcCounter;
const char *SrcBitmapStart;
const char *SrcNameStart;
const char *SrcValueProfDataStart, *SrcValueProfData;
uintptr_t CountersDelta = Header->CountersDelta;
uintptr_t BitmapDelta = Header->BitmapDelta;

SrcDataStart =
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
Expand All @@ -130,12 +123,11 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
SrcCountersStart = (char *)SrcDataEnd;
SrcCountersEnd = SrcCountersStart +
Header->NumCounters * __llvm_profile_counter_entry_size();
SrcBitmapStart = SrcCountersEnd;
SrcNameStart = SrcBitmapStart + Header->NumBitmapBytes;
SrcNameStart = SrcCountersEnd;
SrcValueProfDataStart =
SrcNameStart + Header->NamesSize +
__llvm_profile_get_num_padding_bytes(Header->NamesSize);
if (SrcNameStart < SrcCountersStart || SrcNameStart < SrcBitmapStart)
if (SrcNameStart < SrcCountersStart)
return 1;

// Merge counters by iterating the entire counter section when debug info
Expand Down Expand Up @@ -165,8 +157,6 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
// extend CounterPtr to get the original value.
char *DstCounters =
(char *)((uintptr_t)DstData + signextIfWin64(DstData->CounterPtr));
char *DstBitmap =
(char *)((uintptr_t)DstData + signextIfWin64(DstData->BitmapPtr));
unsigned NVK = 0;

// SrcData is a serialized representation of the memory image. We need to
Expand Down Expand Up @@ -196,21 +186,6 @@ int __llvm_profile_merge_from_buffer(const char *ProfileData,
}
}

const char *SrcBitmap =
SrcBitmapStart + ((uintptr_t)SrcData->BitmapPtr - BitmapDelta);
// BitmapDelta also needs to be decreased as we advance to the next data
// record.
BitmapDelta -= sizeof(*SrcData);
unsigned NB = SrcData->NumBitmapBytes;
// NumBitmapBytes may legitimately be 0. Just keep going.
if (NB != 0) {
if (SrcBitmap < SrcBitmapStart || (SrcBitmap + NB) > SrcNameStart)
return 1;
// Merge Src and Dst Bitmap bytes by simply ORing them together.
for (unsigned I = 0; I < NB; I++)
DstBitmap[I] |= SrcBitmap[I];
}

/* Now merge value profile data. */
if (!VPMergeHook)
continue;
Expand Down
9 changes: 0 additions & 9 deletions compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ extern char
COMPILER_RT_VISIBILITY
extern char CountersEnd __asm("section$end$__DATA$" INSTR_PROF_CNTS_SECT_NAME);
COMPILER_RT_VISIBILITY
extern char
BitmapStart __asm("section$start$__DATA$" INSTR_PROF_BITS_SECT_NAME);
COMPILER_RT_VISIBILITY
extern char BitmapEnd __asm("section$end$__DATA$" INSTR_PROF_BITS_SECT_NAME);
COMPILER_RT_VISIBILITY
extern uint32_t
OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME);

Expand All @@ -61,10 +56,6 @@ char *__llvm_profile_begin_counters(void) { return &CountersStart; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_end_counters(void) { return &CountersEnd; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_bitmap(void) { return &BitmapStart; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_end_bitmap(void) { return &BitmapEnd; }
COMPILER_RT_VISIBILITY
uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; }

COMPILER_RT_VISIBILITY
Expand Down
10 changes: 0 additions & 10 deletions compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#define PROF_NAME_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_NAME_COMMON)
#define PROF_CNTS_START INSTR_PROF_SECT_START(INSTR_PROF_CNTS_COMMON)
#define PROF_CNTS_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_CNTS_COMMON)
#define PROF_BITS_START INSTR_PROF_SECT_START(INSTR_PROF_BITS_COMMON)
#define PROF_BITS_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_BITS_COMMON)
#define PROF_ORDERFILE_START INSTR_PROF_SECT_START(INSTR_PROF_ORDERFILE_COMMON)
#define PROF_VNODES_START INSTR_PROF_SECT_START(INSTR_PROF_VNODES_COMMON)
#define PROF_VNODES_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_VNODES_COMMON)
Expand All @@ -50,8 +48,6 @@ extern __llvm_profile_data PROF_DATA_STOP COMPILER_RT_VISIBILITY
COMPILER_RT_WEAK;
extern char PROF_CNTS_START COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern char PROF_CNTS_STOP COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern char PROF_BITS_START COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern char PROF_BITS_STOP COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern uint32_t PROF_ORDERFILE_START COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern char PROF_NAME_START COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
extern char PROF_NAME_STOP COMPILER_RT_VISIBILITY COMPILER_RT_WEAK;
Expand All @@ -78,12 +74,6 @@ COMPILER_RT_VISIBILITY char *__llvm_profile_begin_counters(void) {
COMPILER_RT_VISIBILITY char *__llvm_profile_end_counters(void) {
return &PROF_CNTS_STOP;
}
COMPILER_RT_VISIBILITY char *__llvm_profile_begin_bitmap(void) {
return &PROF_BITS_START;
}
COMPILER_RT_VISIBILITY char *__llvm_profile_end_bitmap(void) {
return &PROF_BITS_STOP;
}
COMPILER_RT_VISIBILITY uint32_t *__llvm_profile_begin_orderfile(void) {
return &PROF_ORDERFILE_START;
}
Expand Down
4 changes: 0 additions & 4 deletions compiler-rt/lib/profile/InstrProfilingPlatformOther.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_counters(void) { return CountersFirst; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_end_counters(void) { return CountersLast; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_bitmap(void) { return BitmapFirst; }
COMPILER_RT_VISIBILITY
char *__llvm_profile_end_bitmap(void) { return BitmapLast; }
/* TODO: correctly set up OrderFileFirst. */
COMPILER_RT_VISIBILITY
uint32_t *__llvm_profile_begin_orderfile(void) { return OrderFileFirst; }
Expand Down
7 changes: 0 additions & 7 deletions compiler-rt/lib/profile/InstrProfilingPlatformWindows.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#if defined(_MSC_VER)
/* Merge read-write sections into .data. */
#pragma comment(linker, "/MERGE:.lprfc=.data")
#pragma comment(linker, "/MERGE:.lprfb=.data")
#pragma comment(linker, "/MERGE:.lprfd=.data")
#pragma comment(linker, "/MERGE:.lprfv=.data")
#pragma comment(linker, "/MERGE:.lprfnd=.data")
Expand All @@ -31,8 +30,6 @@
#pragma section(".lprfd$Z", read, write)
#pragma section(".lprfc$A", read, write)
#pragma section(".lprfc$Z", read, write)
#pragma section(".lprfb$A", read, write)
#pragma section(".lprfb$Z", read, write)
#pragma section(".lorderfile$A", read, write)
#pragma section(".lprfnd$A", read, write)
#pragma section(".lprfnd$Z", read, write)
Expand All @@ -46,8 +43,6 @@ const char COMPILER_RT_SECTION(".lprfn$Z") NamesEnd = '\0';

char COMPILER_RT_SECTION(".lprfc$A") CountersStart;
char COMPILER_RT_SECTION(".lprfc$Z") CountersEnd;
char COMPILER_RT_SECTION(".lprfb$A") BitmapStart;
char COMPILER_RT_SECTION(".lprfb$Z") BitmapEnd;
uint32_t COMPILER_RT_SECTION(".lorderfile$A") OrderFileStart;

ValueProfNode COMPILER_RT_SECTION(".lprfnd$A") VNodesStart;
Expand All @@ -63,8 +58,6 @@ const char *__llvm_profile_end_names(void) { return &NamesEnd; }

char *__llvm_profile_begin_counters(void) { return &CountersStart + 1; }
char *__llvm_profile_end_counters(void) { return &CountersEnd; }
char *__llvm_profile_begin_bitmap(void) { return &BitmapStart + 1; }
char *__llvm_profile_end_bitmap(void) { return &BitmapEnd; }
uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; }

ValueProfNode *__llvm_profile_begin_vnodes(void) { return &VNodesStart + 1; }
Expand Down
18 changes: 5 additions & 13 deletions compiler-rt/lib/profile/InstrProfilingWriter.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,20 +246,17 @@ COMPILER_RT_VISIBILITY int lprofWriteData(ProfDataWriter *Writer,
const __llvm_profile_data *DataEnd = __llvm_profile_end_data();
const char *CountersBegin = __llvm_profile_begin_counters();
const char *CountersEnd = __llvm_profile_end_counters();
const char *BitmapBegin = __llvm_profile_begin_bitmap();
const char *BitmapEnd = __llvm_profile_end_bitmap();
const char *NamesBegin = __llvm_profile_begin_names();
const char *NamesEnd = __llvm_profile_end_names();
return lprofWriteDataImpl(Writer, DataBegin, DataEnd, CountersBegin,
CountersEnd, BitmapBegin, BitmapEnd, VPDataReader,
NamesBegin, NamesEnd, SkipNameDataWrite);
CountersEnd, VPDataReader, NamesBegin, NamesEnd,
SkipNameDataWrite);
}

COMPILER_RT_VISIBILITY int
lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
const __llvm_profile_data *DataEnd,
const char *CountersBegin, const char *CountersEnd,
const char *BitmapBegin, const char *BitmapEnd,
VPDataReaderType *VPDataReader, const char *NamesBegin,
const char *NamesEnd, int SkipNameDataWrite) {
int DebugInfoCorrelate =
Expand All @@ -274,8 +271,6 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
__llvm_profile_get_counters_size(CountersBegin, CountersEnd);
const uint64_t NumCounters =
__llvm_profile_get_num_counters(CountersBegin, CountersEnd);
const uint64_t NumBitmapBytes =
__llvm_profile_get_num_bitmap_bytes(BitmapBegin, BitmapEnd);
const uint64_t NamesSize = DebugInfoCorrelate ? 0 : NamesEnd - NamesBegin;

/* Create the header. */
Expand All @@ -284,11 +279,11 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
/* Determine how much padding is needed before/after the counters and after
* the names. */
uint64_t PaddingBytesBeforeCounters, PaddingBytesAfterCounters,
PaddingBytesAfterNames, PaddingBytesAfterBitmapBytes;
PaddingBytesAfterNames;
__llvm_profile_get_padding_sizes_for_counters(
DataSectionSize, CountersSectionSize, NumBitmapBytes, NamesSize,
DataSectionSize, CountersSectionSize, NamesSize,
&PaddingBytesBeforeCounters, &PaddingBytesAfterCounters,
&PaddingBytesAfterBitmapBytes, &PaddingBytesAfterNames);
&PaddingBytesAfterNames);

{
/* Initialize header structure. */
Expand All @@ -300,7 +295,6 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
* CountersDelta to match. */
#ifdef _WIN64
Header.CountersDelta = (uint32_t)Header.CountersDelta;
Header.BitmapDelta = (uint32_t)Header.BitmapDelta;
#endif

/* The data and names sections are omitted in lightweight mode. */
Expand All @@ -325,8 +319,6 @@ lprofWriteDataImpl(ProfDataWriter *Writer, const __llvm_profile_data *DataBegin,
{NULL, sizeof(uint8_t), PaddingBytesBeforeCounters, 1},
{CountersBegin, sizeof(uint8_t), CountersSectionSize, 0},
{NULL, sizeof(uint8_t), PaddingBytesAfterCounters, 1},
{BitmapBegin, sizeof(uint8_t), NumBitmapBytes, 0},
{NULL, sizeof(uint8_t), PaddingBytesAfterBitmapBytes, 1},
{(SkipNameDataWrite || DebugInfoCorrelate) ? NULL : NamesBegin,
sizeof(uint8_t), NamesSize, 0},
{NULL, sizeof(uint8_t), PaddingBytesAfterNames, 1}};
Expand Down
21 changes: 9 additions & 12 deletions compiler-rt/test/profile/instrprof-write-buffer-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,30 @@ const char *__llvm_profile_begin_names(void);
const char *__llvm_profile_end_names(void);
char *__llvm_profile_begin_counters(void);
char *__llvm_profile_end_counters(void);
char *__llvm_profile_begin_bitmap(void);
char *__llvm_profile_end_bitmap(void);

uint64_t __llvm_profile_get_size_for_buffer_internal(
const void *DataBegin, const void *DataEnd, const char *CountersBegin,
const char *CountersEnd, const char *BitmapBegin, const char *BitmapEnd,
const char *NamesBegin, const char *NamesEnd);
const char *CountersEnd, const char *NamesBegin, const char *NamesEnd);

int __llvm_profile_write_buffer_internal(
char *Buffer, const void *DataBegin, const void *DataEnd,
const char *CountersBegin, const char *CountersEnd, const char *BitmapBegin,
const char *BitmapEnd, const char *NamesBegin, const char *NamesEnd);
int __llvm_profile_write_buffer_internal(char *Buffer, const void *DataBegin,
const void *DataEnd,
const char *CountersBegin,
const char *CountersEnd,
const char *NamesBegin,
const char *NamesEnd);

void __llvm_profile_set_dumped(void);

int main(int argc, const char *argv[]) {
uint64_t bufsize = __llvm_profile_get_size_for_buffer_internal(
__llvm_profile_begin_data(), __llvm_profile_end_data(),
__llvm_profile_begin_counters(), __llvm_profile_end_counters(),
__llvm_profile_begin_bitmap(), __llvm_profile_end_bitmap(),
__llvm_profile_begin_names(), __llvm_profile_end_names());

char *buf = malloc(bufsize);
int ret = __llvm_profile_write_buffer_internal(
buf, __llvm_profile_begin_data(), __llvm_profile_end_data(),
int ret = __llvm_profile_write_buffer_internal(buf,
__llvm_profile_begin_data(), __llvm_profile_end_data(),
__llvm_profile_begin_counters(), __llvm_profile_end_counters(),
__llvm_profile_begin_bitmap(), __llvm_profile_end_bitmap(),
__llvm_profile_begin_names(), __llvm_profile_end_names());

if (ret != 0) {
Expand Down
138 changes: 0 additions & 138 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13842,144 +13842,6 @@ pass will generate the appropriate data structures and replace the
``llvm.instrprof.value.profile`` intrinsic with the call to the profile
runtime library with proper arguments.

'``llvm.instrprof.mcdc.parameters``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

declare void @llvm.instrprof.mcdc.parameters(ptr <name>, i64 <hash>,
i32 <bitmap-bytes>)

Overview:
"""""""""

The '``llvm.instrprof.mcdc.parameters``' intrinsic is used to initiate MC/DC
code coverage instrumentation for a function.

Arguments:
""""""""""

The first argument is a pointer to a global variable containing the
name of the entity being instrumented. This should generally be the
(mangled) function name for a set of counters.

The second argument is a hash value that can be used by the consumer
of the profile data to detect changes to the instrumented source.

The third argument is the number of bitmap bytes required by the function to
record the number of test vectors executed for each boolean expression.

Semantics:
""""""""""

This intrinsic represents basic MC/DC parameters initiating one or more MC/DC
instrumentation sequences in a function. It will cause the ``-instrprof`` pass
to generate the appropriate data structures and the code to instrument MC/DC
test vectors in a format that can be written out by a compiler runtime and
consumed via the ``llvm-profdata`` tool.

'``llvm.instrprof.mcdc.condbitmap.update``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

declare void @llvm.instrprof.mcdc.condbitmap.update(ptr <name>, i64 <hash>,
i32 <condition-id>,
ptr <mcdc-temp-addr>,
i1 <bool-value>)

Overview:
"""""""""

The '``llvm.instrprof.mcdc.condbitmap.update``' intrinsic is used to track
MC/DC condition evaluation for each condition in a boolean expression.

Arguments:
""""""""""

The first argument is a pointer to a global variable containing the
name of the entity being instrumented. This should generally be the
(mangled) function name for a set of counters.

The second argument is a hash value that can be used by the consumer
of the profile data to detect changes to the instrumented source.

The third argument is an ID of a condition to track. This value is used as a
bit index into the condition bitmap.

The fourth argument is the address of the condition bitmap.

The fifth argument is the boolean value representing the evaluation of the
condition (true or false)

Semantics:
""""""""""

This intrinsic represents the update of a condition bitmap that is local to a
function and will cause the ``-instrprof`` pass to generate the code to
instrument the control flow around each condition in a boolean expression. The
ID of each condition corresponds to a bit index in the condition bitmap which
is set based on the evaluation of the condition.

'``llvm.instrprof.mcdc.tvbitmap.update``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

declare void @llvm.instrprof.mcdc.tvbitmap.update(ptr <name>, i64 <hash>,
i32 <bitmap-bytes>)
i32 <bitmap-index>,
ptr <mcdc-temp-addr>)

Overview:
"""""""""

The '``llvm.instrprof.mcdc.tvbitmap.update``' intrinsic is used to track MC/DC
test vector execution after each boolean expression has been fully executed.
The overall value of the condition bitmap, after it has been successively
updated using the '``llvm.instrprof.mcdc.condbitmap.update``' intrinsic with
the true or false evaluation of each condition, uniquely identifies an executed
MC/DC test vector and is used as a bit index into the global test vector
bitmap.

Arguments:
""""""""""

The first argument is a pointer to a global variable containing the
name of the entity being instrumented. This should generally be the
(mangled) function name for a set of counters.

The second argument is a hash value that can be used by the consumer
of the profile data to detect changes to the instrumented source.

The third argument is the number of bitmap bytes required by the function to
record the number of test vectors executed for each boolean expression.

The fourth argument is the byte index into the global test vector bitmap
corresponding to the function.

The fifth argument is the address of the condition bitmap, which contains a
value representing an executed MC/DC test vector. It is loaded and used as the
bit index of the test vector bitmap.

Semantics:
""""""""""

This intrinsic represents the final operation of an MC/DC instrumentation
sequence and will cause the ``-instrprof`` pass to generate the code to
instrument an update of a function's global test vector bitmap to indicate that
a test vector has been executed. The global test vector bitmap can be consumed
by the ``llvm-profdata`` and ``llvm-cov`` tools.

'``llvm.thread.pointer``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
94 changes: 4 additions & 90 deletions llvm/include/llvm/IR/IntrinsicInst.h
Original file line number Diff line number Diff line change
Expand Up @@ -1424,19 +1424,14 @@ class InstrProfInstBase : public IntrinsicInst {
ConstantInt *getHash() const {
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(1)));
}
};

/// A base class for all instrprof counter intrinsics.
class InstrProfCntrInstBase : public InstrProfInstBase {
public:
// The number of counters for the instrumented function.
ConstantInt *getNumCounters() const;
// The index of the counter that this instruction acts on.
ConstantInt *getIndex() const;
};

/// This represents the llvm.instrprof.cover intrinsic.
class InstrProfCoverInst : public InstrProfCntrInstBase {
class InstrProfCoverInst : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_cover;
Expand All @@ -1447,7 +1442,7 @@ class InstrProfCoverInst : public InstrProfCntrInstBase {
};

/// This represents the llvm.instrprof.increment intrinsic.
class InstrProfIncrementInst : public InstrProfCntrInstBase {
class InstrProfIncrementInst : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_increment ||
Expand All @@ -1471,7 +1466,7 @@ class InstrProfIncrementInstStep : public InstrProfIncrementInst {
};

/// This represents the llvm.instrprof.timestamp intrinsic.
class InstrProfTimestampInst : public InstrProfCntrInstBase {
class InstrProfTimestampInst : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_timestamp;
Expand All @@ -1482,7 +1477,7 @@ class InstrProfTimestampInst : public InstrProfCntrInstBase {
};

/// This represents the llvm.instrprof.value.profile intrinsic.
class InstrProfValueProfileInst : public InstrProfCntrInstBase {
class InstrProfValueProfileInst : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_value_profile;
Expand All @@ -1505,87 +1500,6 @@ class InstrProfValueProfileInst : public InstrProfCntrInstBase {
}
};

/// A base class for instrprof mcdc intrinsics that require global bitmap bytes.
class InstrProfMCDCBitmapInstBase : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_parameters ||
I->getIntrinsicID() == Intrinsic::instrprof_mcdc_tvbitmap_update;
}
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}

/// \return The number of bytes used for the MCDC bitmaps for the instrumented
/// function.
ConstantInt *getNumBitmapBytes() const {
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
}
};

/// This represents the llvm.instrprof.mcdc.parameters intrinsic.
class InstrProfMCDCBitmapParameters : public InstrProfMCDCBitmapInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_parameters;
}
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
};

/// This represents the llvm.instrprof.mcdc.tvbitmap.update intrinsic.
class InstrProfMCDCTVBitmapUpdate : public InstrProfMCDCBitmapInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_tvbitmap_update;
}
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}

/// \return The index of the TestVector Bitmap upon which this intrinsic
/// acts.
ConstantInt *getBitmapIndex() const {
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
}

/// \return The address of the corresponding condition bitmap containing
/// the index of the TestVector to update within the TestVector Bitmap.
Value *getMCDCCondBitmapAddr() const {
return cast<Value>(const_cast<Value *>(getArgOperand(4)));
}
};

/// This represents the llvm.instrprof.mcdc.condbitmap.update intrinsic.
/// It does not pertain to global bitmap updates or parameters and so doesn't
/// inherit from InstrProfMCDCBitmapInstBase.
class InstrProfMCDCCondBitmapUpdate : public InstrProfInstBase {
public:
static bool classof(const IntrinsicInst *I) {
return I->getIntrinsicID() == Intrinsic::instrprof_mcdc_condbitmap_update;
}
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}

/// \return The ID of the condition to update.
ConstantInt *getCondID() const {
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
}

/// \return The address of the corresponding condition bitmap.
Value *getMCDCCondBitmapAddr() const {
return cast<Value>(const_cast<Value *>(getArgOperand(3)));
}

/// \return The boolean value to set in the condition bitmap for the
/// corresponding condition ID. This represents how the condition evaluated.
Value *getCondBool() const {
return cast<Value>(const_cast<Value *>(getArgOperand(4)));
}
};

class PseudoProbeInst : public IntrinsicInst {
public:
static bool classof(const IntrinsicInst *I) {
Expand Down
15 changes: 0 additions & 15 deletions llvm/include/llvm/IR/Intrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -917,21 +917,6 @@ def int_instrprof_value_profile : Intrinsic<[],
llvm_i64_ty, llvm_i32_ty,
llvm_i32_ty]>;

// A parameter configuration for instrumentation based MCDC profiling.
def int_instrprof_mcdc_parameters : Intrinsic<[],
[llvm_ptr_ty, llvm_i64_ty,
llvm_i32_ty]>;

// A test vector bitmap update for instrumentation based MCDC profiling.
def int_instrprof_mcdc_tvbitmap_update : Intrinsic<[],
[llvm_ptr_ty, llvm_i64_ty,
llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty]>;

// A condition bitmap value update for instrumentation based MCDC profiling.
def int_instrprof_mcdc_condbitmap_update : Intrinsic<[],
[llvm_ptr_ty, llvm_i64_ty,
llvm_i32_ty, llvm_ptr_ty, llvm_i1_ty]>;

def int_call_preallocated_setup : DefaultAttrsIntrinsic<[llvm_token_ty], [llvm_i32_ty]>;
def int_call_preallocated_arg : DefaultAttrsIntrinsic<[llvm_ptr_ty], [llvm_token_ty, llvm_i32_ty]>;
def int_call_preallocated_teardown : DefaultAttrsIntrinsic<[], [llvm_token_ty]>;
Expand Down
4 changes: 1 addition & 3 deletions llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -1027,9 +1027,7 @@ enum CovMapVersion {
// Compilation directory is stored separately and combined with relative
// filenames to produce an absolute file path.
Version6 = 5,
// Branch regions extended and Decision Regions added for MC/DC.
Version7 = 6,
// The current version is Version7.
// The current version is Version6.
CurrentVersion = INSTR_PROF_COVMAP_VERSION
};

Expand Down
21 changes: 2 additions & 19 deletions llvm/include/llvm/ProfileData/InstrProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ inline StringRef getInstrProfDataVarPrefix() { return "__profd_"; }
/// Return the name prefix of profile counter variables.
inline StringRef getInstrProfCountersVarPrefix() { return "__profc_"; }

/// Return the name prefix of profile bitmap variables.
inline StringRef getInstrProfBitmapVarPrefix() { return "__profbm_"; }

/// Return the name prefix of value profile variables.
inline StringRef getInstrProfValuesVarPrefix() { return "__profvp_"; }

Expand Down Expand Up @@ -338,7 +335,6 @@ enum class instrprof_error {
invalid_prof,
hash_mismatch,
count_mismatch,
bitmap_mismatch,
counter_overflow,
value_site_count_mismatch,
compress_failed,
Expand Down Expand Up @@ -694,23 +690,18 @@ struct InstrProfValueSiteRecord {
/// Profiling information for a single function.
struct InstrProfRecord {
std::vector<uint64_t> Counts;
std::vector<uint8_t> BitmapBytes;

InstrProfRecord() = default;
InstrProfRecord(std::vector<uint64_t> Counts) : Counts(std::move(Counts)) {}
InstrProfRecord(std::vector<uint64_t> Counts,
std::vector<uint8_t> BitmapBytes)
: Counts(std::move(Counts)), BitmapBytes(std::move(BitmapBytes)) {}
InstrProfRecord(InstrProfRecord &&) = default;
InstrProfRecord(const InstrProfRecord &RHS)
: Counts(RHS.Counts), BitmapBytes(RHS.BitmapBytes),
: Counts(RHS.Counts),
ValueData(RHS.ValueData
? std::make_unique<ValueProfData>(*RHS.ValueData)
: nullptr) {}
InstrProfRecord &operator=(InstrProfRecord &&) = default;
InstrProfRecord &operator=(const InstrProfRecord &RHS) {
Counts = RHS.Counts;
BitmapBytes = RHS.BitmapBytes;
if (!RHS.ValueData) {
ValueData = nullptr;
return *this;
Expand Down Expand Up @@ -889,11 +880,6 @@ struct NamedInstrProfRecord : InstrProfRecord {
NamedInstrProfRecord(StringRef Name, uint64_t Hash,
std::vector<uint64_t> Counts)
: InstrProfRecord(std::move(Counts)), Name(Name), Hash(Hash) {}
NamedInstrProfRecord(StringRef Name, uint64_t Hash,
std::vector<uint64_t> Counts,
std::vector<uint8_t> BitmapBytes)
: InstrProfRecord(std::move(Counts), std::move(BitmapBytes)), Name(Name),
Hash(Hash) {}

static bool hasCSFlagInHash(uint64_t FuncHash) {
return ((FuncHash >> CS_FLAG_IN_FUNC_HASH) & 1);
Expand Down Expand Up @@ -1029,9 +1015,7 @@ enum ProfVersion {
Version9 = 9,
// An additional (optional) temporal profile traces section is added.
Version10 = 10,
// An additional field is used for bitmap bytes.
Version11 = 11,
// The current version is 11.
// The current version is 10.
CurrentVersion = INSTR_PROF_INDEX_VERSION
};
const uint64_t Version = ProfVersion::CurrentVersion;
Expand Down Expand Up @@ -1169,7 +1153,6 @@ namespace RawInstrProf {
// Version 6: Added binary id.
// Version 7: Reorder binary id and include version in signature.
// Version 8: Use relative counter pointer.
// Version 9: Added relative bitmap bytes pointer and count used by MC/DC.
const uint64_t Version = INSTR_PROF_RAW_VERSION;

template <class IntPtrT> inline uint64_t getMagic();
Expand Down
22 changes: 4 additions & 18 deletions llvm/include/llvm/ProfileData/InstrProfData.inc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ INSTR_PROF_DATA(const uint64_t, llvm::Type::getInt64Ty(Ctx), FuncHash, \
ConstantInt::get(llvm::Type::getInt64Ty(Ctx), \
Inc->getHash()->getZExtValue()))
INSTR_PROF_DATA(const IntPtrT, IntPtrTy, CounterPtr, RelativeCounterPtr)
INSTR_PROF_DATA(const IntPtrT, IntPtrTy, BitmapPtr, RelativeBitmapPtr)
/* This is used to map function pointers for the indirect call targets to
* function name hashes during the conversion from raw to merged profile
* data.
Expand All @@ -88,9 +87,7 @@ INSTR_PROF_DATA(IntPtrT, llvm::Type::getInt8PtrTy(Ctx), Values, \
INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumCounters, \
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumCounters))
INSTR_PROF_DATA(const uint16_t, Int16ArrayTy, NumValueSites[IPVK_Last+1], \
ConstantArray::get(Int16ArrayTy, Int16ArrayVals)) \
INSTR_PROF_DATA(const uint32_t, llvm::Type::getInt32Ty(Ctx), NumBitmapBytes, \
ConstantInt::get(llvm::Type::getInt32Ty(Ctx), NumBitmapBytes))
ConstantArray::get(Int16ArrayTy, Int16ArrayVals))
#undef INSTR_PROF_DATA
/* INSTR_PROF_DATA end. */

Expand Down Expand Up @@ -135,13 +132,9 @@ INSTR_PROF_RAW_HEADER(uint64_t, NumData, NumData)
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesBeforeCounters, PaddingBytesBeforeCounters)
INSTR_PROF_RAW_HEADER(uint64_t, NumCounters, NumCounters)
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesAfterCounters, PaddingBytesAfterCounters)
INSTR_PROF_RAW_HEADER(uint64_t, NumBitmapBytes, NumBitmapBytes)
INSTR_PROF_RAW_HEADER(uint64_t, PaddingBytesAfterBitmapBytes, PaddingBytesAfterBitmapBytes)
INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta,
(uintptr_t)CountersBegin - (uintptr_t)DataBegin)
INSTR_PROF_RAW_HEADER(uint64_t, BitmapDelta,
(uintptr_t)BitmapBegin - (uintptr_t)DataBegin)
INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)
#undef INSTR_PROF_RAW_HEADER
Expand Down Expand Up @@ -274,9 +267,6 @@ INSTR_PROF_SECT_ENTRY(IPSK_data, \
INSTR_PROF_SECT_ENTRY(IPSK_cnts, \
INSTR_PROF_QUOTE(INSTR_PROF_CNTS_COMMON), \
INSTR_PROF_CNTS_COFF, "__DATA,")
INSTR_PROF_SECT_ENTRY(IPSK_bitmap, \
INSTR_PROF_QUOTE(INSTR_PROF_BITS_COMMON), \
INSTR_PROF_BITS_COFF, "__DATA,")
INSTR_PROF_SECT_ENTRY(IPSK_name, \
INSTR_PROF_QUOTE(INSTR_PROF_NAME_COMMON), \
INSTR_PROF_NAME_COFF, "__DATA,")
Expand Down Expand Up @@ -656,11 +646,11 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,

/* FIXME: Please remedy the fixme in the header before bumping the version. */
/* Raw profile format version (start from 1). */
#define INSTR_PROF_RAW_VERSION 9
#define INSTR_PROF_RAW_VERSION 8
/* Indexed profile format version (start from 1). */
#define INSTR_PROF_INDEX_VERSION 11
#define INSTR_PROF_INDEX_VERSION 10
/* Coverage mapping format version (start from 0). */
#define INSTR_PROF_COVMAP_VERSION 6
#define INSTR_PROF_COVMAP_VERSION 5

/* Profile version is always of type uint64_t. Reserve the upper 8 bits in the
* version for other variants of profile. We set the lowest bit of the upper 8
Expand Down Expand Up @@ -697,7 +687,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
#define INSTR_PROF_DATA_COMMON __llvm_prf_data
#define INSTR_PROF_NAME_COMMON __llvm_prf_names
#define INSTR_PROF_CNTS_COMMON __llvm_prf_cnts
#define INSTR_PROF_BITS_COMMON __llvm_prf_bits
#define INSTR_PROF_VALS_COMMON __llvm_prf_vals
#define INSTR_PROF_VNODES_COMMON __llvm_prf_vnds
#define INSTR_PROF_COVMAP_COMMON __llvm_covmap
Expand All @@ -709,7 +698,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
#define INSTR_PROF_DATA_COFF ".lprfd$M"
#define INSTR_PROF_NAME_COFF ".lprfn$M"
#define INSTR_PROF_CNTS_COFF ".lprfc$M"
#define INSTR_PROF_BITS_COFF ".lprfb$M"
#define INSTR_PROF_VALS_COFF ".lprfv$M"
#define INSTR_PROF_VNODES_COFF ".lprfnd$M"
#define INSTR_PROF_COVMAP_COFF ".lcovmap$M"
Expand All @@ -721,7 +709,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
#define INSTR_PROF_DATA_SECT_NAME INSTR_PROF_DATA_COFF
#define INSTR_PROF_NAME_SECT_NAME INSTR_PROF_NAME_COFF
#define INSTR_PROF_CNTS_SECT_NAME INSTR_PROF_CNTS_COFF
#define INSTR_PROF_BITS_SECT_NAME INSTR_PROF_BITS_COFF
/* Array of pointers. Each pointer points to a list
* of value nodes associated with one value site.
*/
Expand All @@ -736,7 +723,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
#define INSTR_PROF_DATA_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_DATA_COMMON)
#define INSTR_PROF_NAME_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_NAME_COMMON)
#define INSTR_PROF_CNTS_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_CNTS_COMMON)
#define INSTR_PROF_BITS_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_BITS_COMMON)
/* Array of pointers. Each pointer points to a list
* of value nodes associated with one value site.
*/
Expand Down
9 changes: 0 additions & 9 deletions llvm/include/llvm/ProfileData/InstrProfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,11 @@ class RawInstrProfReader : public InstrProfReader {
// the variant types of the profile.
uint64_t Version;
uint64_t CountersDelta;
uint64_t BitmapDelta;
uint64_t NamesDelta;
const RawInstrProf::ProfileData<IntPtrT> *Data;
const RawInstrProf::ProfileData<IntPtrT> *DataEnd;
const char *CountersStart;
const char *CountersEnd;
const char *BitmapStart;
const char *BitmapEnd;
const char *NamesStart;
const char *NamesEnd;
// After value profile is all read, this pointer points to
Expand Down Expand Up @@ -432,7 +429,6 @@ class RawInstrProfReader : public InstrProfReader {
Error readName(NamedInstrProfRecord &Record);
Error readFuncHash(NamedInstrProfRecord &Record);
Error readRawCounts(InstrProfRecord &Record);
Error readRawBitmapBytes(InstrProfRecord &Record);
Error readValueProfilingData(InstrProfRecord &Record);
bool atEnd() const { return Data == DataEnd; }

Expand All @@ -445,7 +441,6 @@ class RawInstrProfReader : public InstrProfReader {
// As we advance to the next record, we maintain the correct CountersDelta
// with respect to the next record.
CountersDelta -= sizeof(*Data);
BitmapDelta -= sizeof(*Data);
}
Data++;
ValueDataStart += CurValueDataSize;
Expand Down Expand Up @@ -737,10 +732,6 @@ class IndexedInstrProfReader : public InstrProfReader {
Error getFunctionCounts(StringRef FuncName, uint64_t FuncHash,
std::vector<uint64_t> &Counts);

/// Fill Bitmap Bytes with the profile data for the given function name.
Error getFunctionBitmapBytes(StringRef FuncName, uint64_t FuncHash,
std::vector<uint8_t> &BitmapBytes);

/// Return the maximum of all known function counts.
/// \c UseCS indicates whether to use the context-sensitive count.
uint64_t getMaximumFunctionCount(bool UseCS) {
Expand Down
46 changes: 3 additions & 43 deletions llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class InstrProfiling : public PassInfoMixin<InstrProfiling> {
uint32_t NumValueSites[IPVK_Last + 1];
GlobalVariable *RegionCounters = nullptr;
GlobalVariable *DataVar = nullptr;
GlobalVariable *RegionBitmaps = nullptr;

PerFunctionProfileData() {
memset(NumValueSites, 0, sizeof(uint32_t) * (IPVK_Last + 1));
Expand Down Expand Up @@ -106,59 +105,20 @@ class InstrProfiling : public PassInfoMixin<InstrProfiling> {
/// Force emitting of name vars for unused functions.
void lowerCoverageData(GlobalVariable *CoverageNamesVar);

/// Replace instrprof.mcdc.tvbitmask.update with a shift and or instruction
/// using the index represented by the a temp value into a bitmap.
void lowerMCDCTestVectorBitmapUpdate(InstrProfMCDCTVBitmapUpdate *Ins);

/// Replace instrprof.mcdc.temp.update with a shift and or instruction using
/// the corresponding condition ID.
void lowerMCDCCondBitmapUpdate(InstrProfMCDCCondBitmapUpdate *Ins);

/// Compute the address of the counter value that this profiling instruction
/// acts on.
Value *getCounterAddress(InstrProfCntrInstBase *I);
Value *getCounterAddress(InstrProfInstBase *I);

/// Get the region counters for an increment, creating them if necessary.
///
/// If the counter array doesn't yet exist, the profile data variables
/// referring to them will also be created.
GlobalVariable *getOrCreateRegionCounters(InstrProfCntrInstBase *Inc);
GlobalVariable *getOrCreateRegionCounters(InstrProfInstBase *Inc);

/// Create the region counters.
GlobalVariable *createRegionCounters(InstrProfCntrInstBase *Inc,
StringRef Name,
GlobalVariable *createRegionCounters(InstrProfInstBase *Inc, StringRef Name,
GlobalValue::LinkageTypes Linkage);

/// Compute the address of the test vector bitmap that this profiling
/// instruction acts on.
Value *getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I);

/// Get the region bitmaps for an increment, creating them if necessary.
///
/// If the bitmap array doesn't yet exist, the profile data variables
/// referring to them will also be created.
GlobalVariable *getOrCreateRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc);

/// Create the MC/DC bitmap as a byte-aligned array of bytes associated with
/// an MC/DC Decision region. The number of bytes required is indicated by
/// the intrinsic used (type InstrProfMCDCBitmapInstBase). This is called
/// as part of setupProfileSection() and is conceptually very similar to
/// what is done for profile data counters in createRegionCounters().
GlobalVariable *createRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc,
StringRef Name,
GlobalValue::LinkageTypes Linkage);

/// Set Comdat property of GV, if required.
void maybeSetComdat(GlobalVariable *GV, Function *Fn, StringRef VarName);

/// Setup the sections into which counters and bitmaps are allocated.
GlobalVariable *setupProfileSection(InstrProfInstBase *Inc,
InstrProfSectKind IPSK);

/// Create INSTR_PROF_DATA variable for counters and bitmaps.
void createDataVariable(InstrProfCntrInstBase *Inc,
InstrProfMCDCBitmapParameters *Update);

/// Emit the section with compressed function names.
void emitNameData();

Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7196,12 +7196,6 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
llvm_unreachable("instrprof failed to lower a timestamp");
case Intrinsic::instrprof_value_profile:
llvm_unreachable("instrprof failed to lower a value profiling call");
case Intrinsic::instrprof_mcdc_parameters:
llvm_unreachable("instrprof failed to lower mcdc parameters");
case Intrinsic::instrprof_mcdc_tvbitmap_update:
llvm_unreachable("instrprof failed to lower an mcdc tvbitmap update");
case Intrinsic::instrprof_mcdc_condbitmap_update:
llvm_unreachable("instrprof failed to lower an mcdc condbitmap update");
case Intrinsic::localescape: {
MachineFunction &MF = DAG.getMachineFunction();
const TargetInstrInfo *TII = DAG.getSubtarget().getInstrInfo();
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/IR/IntrinsicInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,
return -1;
}

ConstantInt *InstrProfCntrInstBase::getNumCounters() const {
ConstantInt *InstrProfInstBase::getNumCounters() const {
if (InstrProfValueProfileInst::classof(this))
llvm_unreachable("InstrProfValueProfileInst does not have counters!");
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
}

ConstantInt *InstrProfCntrInstBase::getIndex() const {
ConstantInt *InstrProfInstBase::getIndex() const {
if (InstrProfValueProfileInst::classof(this))
llvm_unreachable("Please use InstrProfValueProfileInst::getIndex()");
return cast<ConstantInt>(const_cast<Value *>(getArgOperand(3)));
Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,6 @@ Expected<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
case CovMapVersion::Version4:
case CovMapVersion::Version5:
case CovMapVersion::Version6:
case CovMapVersion::Version7:
// Decompress the name data.
if (Error E = P.create(P.getNameData()))
return std::move(E);
Expand All @@ -803,9 +802,6 @@ Expected<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
else if (Version == CovMapVersion::Version6)
return std::make_unique<VersionedCovMapFuncRecordReader<
CovMapVersion::Version6, IntPtrT, Endian>>(P, R, D, F);
else if (Version == CovMapVersion::Version7)
return std::make_unique<VersionedCovMapFuncRecordReader<
CovMapVersion::Version7, IntPtrT, Endian>>(P, R, D, F);
}
llvm_unreachable("Unsupported version");
}
Expand Down
23 changes: 2 additions & 21 deletions llvm/lib/ProfileData/InstrProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ static std::string getInstrProfErrString(instrprof_error Err,
case instrprof_error::count_mismatch:
OS << "function basic block count change detected (counter mismatch)";
break;
case instrprof_error::bitmap_mismatch:
OS << "function bitmap size change detected (bitmap size mismatch)";
break;
case instrprof_error::counter_overflow:
OS << "counter overflow";
break;
Expand Down Expand Up @@ -807,18 +804,6 @@ void InstrProfRecord::merge(InstrProfRecord &Other, uint64_t Weight,
Warn(instrprof_error::counter_overflow);
}

// If the number of bitmap bytes doesn't match we either have bad data
// or a hash collision.
if (BitmapBytes.size() != Other.BitmapBytes.size()) {
Warn(instrprof_error::bitmap_mismatch);
return;
}

// Bitmap bytes are merged by simply ORing them together.
for (size_t I = 0, E = Other.BitmapBytes.size(); I < E; ++I) {
BitmapBytes[I] = Other.BitmapBytes[I] | BitmapBytes[I];
}

for (uint32_t Kind = IPVK_First; Kind <= IPVK_Last; ++Kind)
mergeValueProfData(Kind, Other, Weight, Warn);
}
Expand Down Expand Up @@ -1491,11 +1476,9 @@ Expected<Header> Header::readFromBuffer(const unsigned char *Buffer) {
// When a new field is added in the header add a case statement here to
// populate it.
static_assert(
IndexedInstrProf::ProfVersion::CurrentVersion == Version11,
IndexedInstrProf::ProfVersion::CurrentVersion == Version10,
"Please update the reading code below if a new field has been added, "
"if not add a case statement to fall through to the latest version.");
case 11ull:
[[fallthrough]];
case 10ull:
H.TemporalProfTracesOffset =
read(Buffer, offsetOf(&Header::TemporalProfTracesOffset));
Expand All @@ -1519,12 +1502,10 @@ size_t Header::size() const {
// When a new field is added to the header add a case statement here to
// compute the size as offset of the new field + size of the new field. This
// relies on the field being added to the end of the list.
static_assert(IndexedInstrProf::ProfVersion::CurrentVersion == Version11,
static_assert(IndexedInstrProf::ProfVersion::CurrentVersion == Version10,
"Please update the size computation below if a new field has "
"been added to the header, if not add a case statement to "
"fall through to the latest version.");
case 11ull:
[[fallthrough]];
case 10ull:
return offsetOf(&Header::TemporalProfTracesOffset) +
sizeof(Header::TemporalProfTracesOffset);
Expand Down
4 changes: 0 additions & 4 deletions llvm/lib/ProfileData/InstrProfCorrelator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,11 @@ void InstrProfCorrelatorImpl<IntPtrT>::addProbe(StringRef FunctionName,
// In this mode, CounterPtr actually stores the section relative address
// of the counter.
maybeSwap<IntPtrT>(CounterOffset),
// TODO: MC/DC is not yet supported.
/*BitmapOffset=*/maybeSwap<IntPtrT>(0),
maybeSwap<IntPtrT>(FunctionPtr),
// TODO: Value profiling is not yet supported.
/*ValuesPtr=*/maybeSwap<IntPtrT>(0),
maybeSwap<uint32_t>(NumCounters),
/*NumValueSites=*/{maybeSwap<uint16_t>(0), maybeSwap<uint16_t>(0)},
// TODO: MC/DC is not yet supported.
/*NumBitmapBytes=*/maybeSwap<uint32_t>(0),
});
NamesVec.push_back(FunctionName.str());
}
Expand Down
109 changes: 2 additions & 107 deletions llvm/lib/ProfileData/InstrProfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,29 +433,6 @@ Error TextInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) {
Record.Counts.push_back(Count);
}

// Bitmap byte information is indicated with special character.
if (Line->startswith("$")) {
Record.BitmapBytes.clear();
// Read the number of bitmap bytes.
uint64_t NumBitmapBytes;
if ((Line++)->drop_front(1).trim().getAsInteger(0, NumBitmapBytes))
return error(instrprof_error::malformed,
"number of bitmap bytes is not a valid integer");
if (NumBitmapBytes != 0) {
// Read each bitmap and fill our internal storage with the values.
Record.BitmapBytes.reserve(NumBitmapBytes);
for (uint8_t I = 0; I < NumBitmapBytes; ++I) {
if (Line.is_at_end())
return error(instrprof_error::truncated);
uint8_t BitmapByte;
if ((Line++)->getAsInteger(0, BitmapByte))
return error(instrprof_error::malformed,
"bitmap byte is not a valid integer");
Record.BitmapBytes.push_back(BitmapByte);
}
}
}

// Check if value profile data exists and read it if so.
if (Error E = readValueProfileData(Record))
return error(std::move(E));
Expand Down Expand Up @@ -572,14 +549,11 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
return error(instrprof_error::bad_header);

CountersDelta = swap(Header.CountersDelta);
BitmapDelta = swap(Header.BitmapDelta);
NamesDelta = swap(Header.NamesDelta);
auto NumData = swap(Header.NumData);
auto PaddingBytesBeforeCounters = swap(Header.PaddingBytesBeforeCounters);
auto CountersSize = swap(Header.NumCounters) * getCounterTypeSize();
auto PaddingBytesAfterCounters = swap(Header.PaddingBytesAfterCounters);
auto NumBitmapBytes = swap(Header.NumBitmapBytes);
auto PaddingBytesAfterBitmapBytes = swap(Header.PaddingBytesAfterBitmapBytes);
auto NamesSize = swap(Header.NamesSize);
ValueKindLast = swap(Header.ValueKindLast);

Expand All @@ -589,10 +563,8 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
// Profile data starts after profile header and binary ids if exist.
ptrdiff_t DataOffset = sizeof(RawInstrProf::Header) + BinaryIdsSize;
ptrdiff_t CountersOffset = DataOffset + DataSize + PaddingBytesBeforeCounters;
ptrdiff_t BitmapOffset =
CountersOffset + CountersSize + PaddingBytesAfterCounters;
ptrdiff_t NamesOffset =
BitmapOffset + NumBitmapBytes + PaddingBytesAfterBitmapBytes;
CountersOffset + CountersSize + PaddingBytesAfterCounters;
ptrdiff_t ValueDataOffset = NamesOffset + NamesSize + PaddingSize;

auto *Start = reinterpret_cast<const char *>(&Header);
Expand Down Expand Up @@ -621,8 +593,6 @@ Error RawInstrProfReader<IntPtrT>::readHeader(
reinterpret_cast<const uint8_t *>(&Header) + sizeof(RawInstrProf::Header);
CountersStart = Start + CountersOffset;
CountersEnd = CountersStart + CountersSize;
BitmapStart = Start + BitmapOffset;
BitmapEnd = BitmapStart + NumBitmapBytes;
ValueDataStart = reinterpret_cast<const uint8_t *>(Start + ValueDataOffset);

const uint8_t *BufferEnd = (const uint8_t *)DataBuffer->getBufferEnd();
Expand Down Expand Up @@ -713,49 +683,6 @@ Error RawInstrProfReader<IntPtrT>::readRawCounts(
return success();
}

template <class IntPtrT>
Error RawInstrProfReader<IntPtrT>::readRawBitmapBytes(InstrProfRecord &Record) {
uint32_t NumBitmapBytes = swap(Data->NumBitmapBytes);

Record.BitmapBytes.clear();
Record.BitmapBytes.reserve(NumBitmapBytes);

// It's possible MCDC is either not enabled or only used for some functions
// and not others. So if we record 0 bytes, just move on.
if (NumBitmapBytes == 0)
return success();

// BitmapDelta decreases as we advance to the next data record.
ptrdiff_t BitmapOffset = swap(Data->BitmapPtr) - BitmapDelta;
if (BitmapOffset < 0)
return error(
instrprof_error::malformed,
("bitmap offset " + Twine(BitmapOffset) + " is negative").str());

if (BitmapOffset >= BitmapEnd - BitmapStart)
return error(instrprof_error::malformed,
("bitmap offset " + Twine(BitmapOffset) +
" is greater than the maximum bitmap offset " +
Twine(BitmapEnd - BitmapStart - 1))
.str());

uint64_t MaxNumBitmapBytes =
(BitmapEnd - (BitmapStart + BitmapOffset)) / sizeof(uint8_t);
if (NumBitmapBytes > MaxNumBitmapBytes)
return error(instrprof_error::malformed,
("number of bitmap bytes " + Twine(NumBitmapBytes) +
" is greater than the maximum number of bitmap bytes " +
Twine(MaxNumBitmapBytes))
.str());

for (uint32_t I = 0; I < NumBitmapBytes; I++) {
const char *Ptr = BitmapStart + BitmapOffset + I;
Record.BitmapBytes.push_back(swap(*Ptr));
}

return success();
}

template <class IntPtrT>
Error RawInstrProfReader<IntPtrT>::readValueProfilingData(
InstrProfRecord &Record) {
Expand Down Expand Up @@ -806,10 +733,6 @@ Error RawInstrProfReader<IntPtrT>::readNextRecord(NamedInstrProfRecord &Record)
if (Error E = readRawCounts(Record))
return error(std::move(E));

// Read raw bitmap bytes and set Record.
if (Error E = readRawBitmapBytes(Record))
return error(std::move(E));

// Read value data and set Record.
if (Error E = readValueProfilingData(Record))
return error(std::move(E));
Expand Down Expand Up @@ -871,7 +794,6 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,

DataBuffer.clear();
std::vector<uint64_t> CounterBuffer;
std::vector<uint8_t> BitmapByteBuffer;

const unsigned char *End = D + N;
while (D < End) {
Expand All @@ -897,24 +819,7 @@ data_type InstrProfLookupTrait::ReadData(StringRef K, const unsigned char *D,
for (uint64_t J = 0; J < CountsSize; ++J)
CounterBuffer.push_back(endian::readNext<uint64_t, little, unaligned>(D));

// Read bitmap bytes for GET_VERSION(FormatVersion) > 8.
if (GET_VERSION(FormatVersion) > IndexedInstrProf::ProfVersion::Version8) {
uint64_t BitmapBytes = 0;
if (D + sizeof(uint64_t) > End)
return data_type();
BitmapBytes = endian::readNext<uint64_t, little, unaligned>(D);
// Read bitmap byte values.
if (D + BitmapBytes * sizeof(uint8_t) > End)
return data_type();
BitmapByteBuffer.clear();
BitmapByteBuffer.reserve(BitmapBytes);
for (uint64_t J = 0; J < BitmapBytes; ++J)
BitmapByteBuffer.push_back(static_cast<uint8_t>(
endian::readNext<uint64_t, little, unaligned>(D)));
}

DataBuffer.emplace_back(K, Hash, std::move(CounterBuffer),
std::move(BitmapByteBuffer));
DataBuffer.emplace_back(K, Hash, std::move(CounterBuffer));

// Read value profiling data.
if (GET_VERSION(FormatVersion) > IndexedInstrProf::ProfVersion::Version2 &&
Expand Down Expand Up @@ -1414,16 +1319,6 @@ Error IndexedInstrProfReader::getFunctionCounts(StringRef FuncName,
return success();
}

Error IndexedInstrProfReader::getFunctionBitmapBytes(
StringRef FuncName, uint64_t FuncHash, std::vector<uint8_t> &BitmapBytes) {
Expected<InstrProfRecord> Record = getInstrProfRecord(FuncName, FuncHash);
if (Error E = Record.takeError())
return error(std::move(E));

BitmapBytes = Record.get().BitmapBytes;
return success();
}

Error IndexedInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) {
ArrayRef<NamedInstrProfRecord> Data;

Expand Down
19 changes: 0 additions & 19 deletions llvm/lib/ProfileData/InstrProfWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ class InstrProfRecordWriterTrait {
M += sizeof(uint64_t); // The function hash
M += sizeof(uint64_t); // The size of the Counts vector
M += ProfRecord.Counts.size() * sizeof(uint64_t);
M += sizeof(uint64_t); // The size of the Bitmap vector
M += ProfRecord.BitmapBytes.size() * sizeof(uint64_t);

// Value data
M += ValueProfData::getSize(ProfileData.second);
Expand Down Expand Up @@ -162,10 +160,6 @@ class InstrProfRecordWriterTrait {
for (uint64_t I : ProfRecord.Counts)
LE.write<uint64_t>(I);

LE.write<uint64_t>(ProfRecord.BitmapBytes.size());
for (uint64_t I : ProfRecord.BitmapBytes)
LE.write<uint64_t>(I);

// Write value data
std::unique_ptr<ValueProfData> VDataPtr =
ValueProfData::serializeFrom(ProfileData.second);
Expand Down Expand Up @@ -386,8 +380,6 @@ bool InstrProfWriter::shouldEncodeData(const ProfilingData &PD) {
const InstrProfRecord &IPR = Func.second;
if (llvm::any_of(IPR.Counts, [](uint64_t Count) { return Count > 0; }))
return true;
if (llvm::any_of(IPR.BitmapBytes, [](uint8_t Byte) { return Byte > 0; }))
return true;
}
return false;
}
Expand Down Expand Up @@ -711,17 +703,6 @@ void InstrProfWriter::writeRecordInText(StringRef Name, uint64_t Hash,
for (uint64_t Count : Func.Counts)
OS << Count << "\n";

if (Func.BitmapBytes.size() > 0) {
OS << "# Num Bitmap Bytes:\n$" << Func.BitmapBytes.size() << "\n";
OS << "# Bitmap Byte Values:\n";
for (uint8_t Byte : Func.BitmapBytes) {
OS << "0x";
OS.write_hex(Byte);
OS << "\n";
}
OS << "\n";
}

uint32_t NumValueKinds = Func.getNumValueKinds();
if (!NumValueKinds) {
OS << "\n";
Expand Down
379 changes: 77 additions & 302 deletions llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp

Large diffs are not rendered by default.

53 changes: 0 additions & 53 deletions llvm/test/Instrumentation/InstrProfiling/mcdc.ll

This file was deleted.

4 changes: 2 additions & 2 deletions llvm/test/Transforms/PGOProfile/comdat_internal.ll
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ $foo = comdat any
; CHECK: @__llvm_profile_raw_version = hidden constant i64 {{[0-9]+}}, comdat
; CHECK-NOT: __profn__stdin__foo
; CHECK: @__profc__stdin__foo.[[#FOO_HASH]] = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", comdat, align 8
; CHECK: @__profd__stdin__foo.[[#FOO_HASH]] = private global { i64, i64, i64, i64, ptr, ptr, i32, [2 x i16], i32 } { i64 {{.*}}, i64 [[#FOO_HASH]], i64 sub (i64 ptrtoint (ptr @__profc__stdin__foo.742261418966908927 to i64), i64 ptrtoint (ptr @__profd__stdin__foo.742261418966908927 to i64)), i64 0, ptr null
; CHECK: @__profd__stdin__foo.[[#FOO_HASH]] = private global { i64, i64, i64, ptr, ptr, i32, [2 x i16] } { i64 {{.*}}, i64 [[#FOO_HASH]], i64 sub (i64 ptrtoint (ptr @__profc__stdin__foo.742261418966908927 to i64), i64 ptrtoint (ptr @__profd__stdin__foo.742261418966908927 to i64)), ptr null
; CHECK-NOT: @foo
; CHECK-SAME: , ptr null, i32 1, [2 x i16] zeroinitializer, i32 0 }, section "__llvm_prf_data", comdat($__profc__stdin__foo.[[#FOO_HASH]]), align 8
; CHECK-SAME: , ptr null, i32 1, [2 x i16] zeroinitializer }, section "__llvm_prf_data", comdat($__profc__stdin__foo.[[#FOO_HASH]]), align 8
; CHECK: @__llvm_prf_nm
; CHECK: @llvm.compiler.used

Expand Down
Binary file modified llvm/test/tools/llvm-profdata/Inputs/basic.profraw
Binary file not shown.
Binary file modified llvm/test/tools/llvm-profdata/Inputs/c-general.profraw
Binary file not shown.
Binary file modified llvm/test/tools/llvm-profdata/Inputs/compressed.profraw
Binary file not shown.
13 changes: 2 additions & 11 deletions llvm/test/tools/llvm-profdata/binary-ids-padding.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
// INSTR_PROF_RAW_HEADER(uint64_t, NumBitmaskBytes, NumBitmaskBytes)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, BitmaskDelta, (uintptr_t)BitmaskBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)

RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
// There will be 2 20-byte binary IDs, so the total Binary IDs size will be 64 bytes.
// 2 * 8 binary ID sizes
// + 2 * 20 binary IDs (of size 20)
Expand All @@ -25,11 +23,8 @@ RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\3\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\20\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\2\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

Expand All @@ -56,18 +51,14 @@ RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

RUN: printf '\067\265\035\031\112\165\023\344' >> %t.profraw
RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\xc8\xff\3\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\xd8\xff\3\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

RUN: printf '\023\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\067\0\0\0\0\0\0\0' >> %t.profraw
Expand Down
5 changes: 1 addition & 4 deletions llvm/test/tools/llvm-profdata/large-binary-id-size.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\40\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
Expand All @@ -9,9 +9,6 @@ RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

// Check for a corrupted size being too large past the end of the file.
RUN: printf '\7\7\7\7\7\7\7\7' >> %t.profraw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
// INSTR_PROF_RAW_HEADER(uint64_t, NumBitmaskBytes, NumBitmaskBytes)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, BitmaskDelta, (uintptr_t)BitmaskBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)

RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\2\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

Expand All @@ -40,9 +35,7 @@ RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

RUN: printf '\023\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\3\0foo\0\0\0' >> %t.profraw
Expand Down
10 changes: 1 addition & 9 deletions llvm/test/tools/llvm-profdata/malformed-num-counters-zero.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,20 @@
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
// INSTR_PROF_RAW_HEADER(uint64_t, NumBitmaskBytes, NumBitmaskBytes)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, BitmaskDelta, (uintptr_t)BitmaskBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)

RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\2\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

Expand All @@ -41,10 +35,8 @@ RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
// Make NumCounters = 0 so that we get "number of counters is zero" error message
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

RUN: printf '\023\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\3\0foo\0\0\0' >> %t.profraw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,20 @@
// INSTR_PROF_RAW_HEADER(uint64_t, BinaryIdsSize, __llvm_write_binary_ids(NULL))
// INSTR_PROF_RAW_HEADER(uint64_t, DataSize, DataSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersSize, CountersSize)
// INSTR_PROF_RAW_HEADER(uint64_t, NumBitmaskBytes, NumBitmaskBytes)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesSize, NamesSize)
// INSTR_PROF_RAW_HEADER(uint64_t, CountersDelta, (uintptr_t)CountersBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, BitmaskDelta, (uintptr_t)BitmaskBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, NamesDelta, (uintptr_t)NamesBegin)
// INSTR_PROF_RAW_HEADER(uint64_t, ValueKindLast, IPVK_Last)

RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\2\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\6\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\6\0\2\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

Expand All @@ -43,12 +38,10 @@ RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
// Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters,
// the profile reader should error out.
RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\02\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw

// Counter Section

Expand Down
201 changes: 0 additions & 201 deletions llvm/test/tools/llvm-profdata/mcdc-bitmap.test

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
RUN: printf '\201rforpl\377' > %t.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t.profraw
// We should fail on this because the binary IDs is not a multiple of 8 bytes.
RUN: printf '\77\0\0\0\0\0\0\0' >> %t.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t.profraw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ RUN: printf '\0\0\0\0\0\0\0\2' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\20' >> %t
RUN: printf '\0\0\0\1\0\4\0\0' >> %t
RUN: printf '\0\0\0\2\0\4\0\0' >> %t
Expand Down
28 changes: 4 additions & 24 deletions llvm/test/tools/llvm-profdata/raw-32-bits-be.test
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
RUN: printf '\377lprofR\201' > %t
RUN: printf '\0\0\0\0\0\0\0\11' >> %t
RUN: printf '\0\0\0\0\0\0\0\10' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\2' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\4' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\20' >> %t
RUN: printf '\0\0\0\0\1\0\0\0' >> %t
RUN: printf '\0\0\0\0\3\0\0\0' >> %t
RUN: printf '\0\0\0\0\2\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\134\370\302\114\333\030\275\254' >> %t
RUN: printf '\0\0\0\0\0\0\0\1' >> %t
RUN: printf '\1\0\0\0' >> %t
RUN: printf '\3\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\1' >> %t
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\344\023\165\112\031\035\265\067' >> %t
RUN: printf '\0\0\0\0\0\0\0\2' >> %t
RUN: printf '\0\xff\xff\xd8' >> %t
RUN: printf '\2\xff\xff\xd3' >> %t
RUN: printf '\0\xff\xff\xe0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\2' >> %t
RUN: printf '\0\0\0\0\0\0\0\1' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\0\0\0\0\0\0\0\023' >> %t
RUN: printf '\0\0\0\0\0\0\0\067' >> %t
RUN: printf '\0\0\0\0\0\0\0\101' >> %t
RUN: printf '\125\125\125\052' >> %t
RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t

RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC

CHECK: Counters:
CHECK: foo:
Expand All @@ -57,14 +48,3 @@ CHECK: Functions shown: 2
CHECK: Total functions: 2
CHECK: Maximum function count: 55
CHECK: Maximum internal block count: 65

MCDC: Num Bitmap Bytes:
MCDC-NEXT: $3
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC: Num Bitmap Bytes:
MCDC-NEXT: $1
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 0x2a
28 changes: 4 additions & 24 deletions llvm/test/tools/llvm-profdata/raw-32-bits-le.test
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
RUN: printf '\201Rforpl\377' > %t
RUN: printf '\11\0\0\0\0\0\0\0' >> %t
RUN: printf '\10\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\2\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\3\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\4\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\20\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\1\0\0\0\0' >> %t
RUN: printf '\0\0\0\3\0\0\0\0' >> %t
RUN: printf '\0\0\0\2\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\254\275\030\333\114\302\370\134' >> %t
RUN: printf '\1\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\1' >> %t
RUN: printf '\0\0\0\3' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\1\0\0\0' >> %t
RUN: printf '\0\0\0\0\3\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\067\265\035\031\112\165\023\344' >> %t
RUN: printf '\02\0\0\0\0\0\0\0' >> %t
RUN: printf '\xd8\xff\xff\0' >> %t
RUN: printf '\xd3\xff\xff\2' >> %t
RUN: printf '\xe0\xff\xff\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\2\0\0\0' >> %t
RUN: printf '\0\0\0\0\1\0\0\0' >> %t
RUN: printf '\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\023\0\0\0\0\0\0\0' >> %t
RUN: printf '\067\0\0\0\0\0\0\0' >> %t
RUN: printf '\101\0\0\0\0\0\0\0' >> %t
RUN: printf '\125\125\125\052' >> %t
RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t

RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC

CHECK: Counters:
CHECK: foo:
Expand All @@ -57,14 +48,3 @@ CHECK: Functions shown: 2
CHECK: Total functions: 2
CHECK: Maximum function count: 55
CHECK: Maximum internal block count: 65

MCDC: Num Bitmap Bytes:
MCDC-NEXT: $3
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC: Num Bitmap Bytes:
MCDC-NEXT: $1
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 0x2a
24 changes: 2 additions & 22 deletions llvm/test/tools/llvm-profdata/raw-64-bits-be.test
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
RUN: printf '\377lprofr\201' > %t
RUN: printf '\0\0\0\0\0\0\0\11' >> %t
RUN: printf '\0\0\0\0\0\0\0\10' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\2' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\3' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\4' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\20' >> %t
RUN: printf '\0\0\0\1\0\4\0\0' >> %t
RUN: printf '\0\0\0\3\0\4\0\0' >> %t
RUN: printf '\0\0\0\2\0\4\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\134\370\302\114\333\030\275\254' >> %t
RUN: printf '\0\0\0\0\0\0\0\1' >> %t
RUN: printf '\0\0\0\1\0\4\0\0' >> %t
RUN: printf '\0\0\0\3\0\4\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\1\0\0\0\0' >> %t
RUN: printf '\0\0\0\3\0\0\0\0' >> %t

RUN: printf '\344\023\165\112\031\035\265\067' >> %t
RUN: printf '\0\0\0\0\0\0\0\02' >> %t
RUN: printf '\0\0\0\1\0\3\xff\xc8' >> %t
RUN: printf '\0\0\0\3\0\3\xff\xc3' >> %t
RUN: printf '\0\0\0\1\0\3\xff\xd8' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\02\0\0\0\0' >> %t
RUN: printf '\0\0\0\1\0\0\0\0' >> %t

RUN: printf '\0\0\0\0\0\0\0\023' >> %t
RUN: printf '\0\0\0\0\0\0\0\067' >> %t
RUN: printf '\0\0\0\0\0\0\0\101' >> %t
RUN: printf '\125\125\125\052' >> %t
RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t

RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC

CHECK: Counters:
CHECK: foo:
Expand All @@ -55,14 +46,3 @@ CHECK: Functions shown: 2
CHECK: Total functions: 2
CHECK: Maximum function count: 55
CHECK: Maximum internal block count: 65

MCDC: Num Bitmap Bytes:
MCDC-NEXT: $3
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC: Num Bitmap Bytes:
MCDC-NEXT: $1
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 0x2a
24 changes: 2 additions & 22 deletions llvm/test/tools/llvm-profdata/raw-64-bits-le.test
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
RUN: printf '\201rforpl\377' > %t
RUN: printf '\11\0\0\0\0\0\0\0' >> %t
RUN: printf '\10\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\2\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\3\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\4\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\20\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\4\0\1\0\0\0' >> %t
RUN: printf '\0\0\4\0\3\0\0\0' >> %t
RUN: printf '\0\0\4\0\2\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t

RUN: printf '\254\275\030\333\114\302\370\134' >> %t
RUN: printf '\1\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\4\0\1\0\0\0' >> %t
RUN: printf '\0\0\4\0\3\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\1\0\0\0\0\0\0\0' >> %t
RUN: printf '\3\0\0\0\0\0\0\0' >> %t

RUN: printf '\067\265\035\031\112\165\023\344' >> %t
RUN: printf '\02\0\0\0\0\0\0\0' >> %t
RUN: printf '\xc8\xff\3\0\1\0\0\0' >> %t
RUN: printf '\xc3\xff\3\0\3\0\0\0' >> %t
RUN: printf '\xd8\xff\3\0\1\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\0\0\0\0\0\0\0\0' >> %t
RUN: printf '\02\0\0\0\0\0\0\0' >> %t
RUN: printf '\1\0\0\0\0\0\0\0' >> %t

RUN: printf '\023\0\0\0\0\0\0\0' >> %t
RUN: printf '\067\0\0\0\0\0\0\0' >> %t
RUN: printf '\101\0\0\0\0\0\0\0' >> %t
RUN: printf '\125\125\125\052' >> %t
RUN: printf '\7\0foo\1bar\0\0\0\0\0\0\0' >> %t

RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s
RUN: llvm-profdata show %t -all-functions -text | FileCheck %s -check-prefix=MCDC

CHECK: Counters:
CHECK: foo:
Expand All @@ -55,14 +46,3 @@ CHECK: Functions shown: 2
CHECK: Total functions: 2
CHECK: Maximum function count: 55
CHECK: Maximum internal block count: 65

MCDC: Num Bitmap Bytes:
MCDC-NEXT: $3
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC-NEXT: 55
MCDC: Num Bitmap Bytes:
MCDC-NEXT: $1
MCDC-NEXT: Bitmap Byte Values:
MCDC-NEXT: 0x2a
14 changes: 2 additions & 12 deletions llvm/test/tools/llvm-profdata/raw-two-profiles.test
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
RUN: printf '\201rforpl\377' > %t-foo.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\4\0\2\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw

Expand All @@ -18,25 +15,20 @@ RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\4\0\1\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-foo.profraw

RUN: printf '\023\0\0\0\0\0\0\0' >> %t-foo.profraw
RUN: printf '\3\0foo\0\0\0' >> %t-foo.profraw

RUN: printf '\201rforpl\377' > %t-bar.profraw
RUN: printf '\11\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\1\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\2\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\10\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\6\0\2\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw

Expand All @@ -45,9 +37,7 @@ RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\6\0\1\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\02\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\0\0\0\0\0\0\0\0' >> %t-bar.profraw

RUN: printf '\067\0\0\0\0\0\0\0' >> %t-bar.profraw
RUN: printf '\101\0\0\0\0\0\0\0' >> %t-bar.profraw
Expand Down