aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/docs/CoverageMappingFormat.rst2
-rw-r--r--llvm/docs/LangRef.rst18
-rw-r--r--llvm/include/llvm/IR/IntrinsicInst.h11
-rw-r--r--llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h3
-rw-r--r--llvm/include/llvm/ProfileData/InstrProf.h2
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp34
-rw-r--r--llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp15
-rw-r--r--llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll6
-rw-r--r--llvm/test/Instrumentation/InstrProfiling/mcdc.ll3
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.obin34528 -> 34504 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext36
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-const.obin5208 -> 5208 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext6
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.obin6456 -> 0 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdatabin888 -> 0 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-general.obin6544 -> 6456 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-general.proftext11
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-macro.obin6408 -> 6480 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext15
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.obin4112 -> 4112 bytes
-rw-r--r--llvm/test/tools/llvm-cov/mcdc-general-18.test20
-rw-r--r--llvm/unittests/ProfileData/CoverageMappingTest.cpp4
22 files changed, 81 insertions, 105 deletions
diff --git a/llvm/docs/CoverageMappingFormat.rst b/llvm/docs/CoverageMappingFormat.rst
index 96bdf8f..f2ae8df 100644
--- a/llvm/docs/CoverageMappingFormat.rst
+++ b/llvm/docs/CoverageMappingFormat.rst
@@ -148,7 +148,7 @@ There are several kinds of mapping regions:
* Decision regions associate multiple branch regions with a boolean
expression in the source code. This information also includes the number of
- bitmap bits needed to represent the expression's executed test vectors as
+ bitmap bytes needed to represent the expression's executed test vectors as
well as the total number of instrumentable branch conditions that comprise
the expression. Decision regions are used to visualize Modified
Condition/Decision Coverage (MC/DC) in *llvm-cov* for each boolean
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 10d53be..f39b8dc 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -14411,7 +14411,7 @@ Syntax:
::
declare void @llvm.instrprof.mcdc.parameters(ptr <name>, i64 <hash>,
- i32 <bitmap-bits>)
+ i32 <bitmap-bytes>)
Overview:
"""""""""
@@ -14429,7 +14429,7 @@ name of the entity being instrumented. This should generally be the
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 bits required by the function to
+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:
@@ -14496,7 +14496,7 @@ Syntax:
::
declare void @llvm.instrprof.mcdc.tvbitmap.update(ptr <name>, i64 <hash>,
- i32 <unused>)
+ i32 <bitmap-bytes>)
i32 <bitmap-index>,
ptr <mcdc-temp-addr>)
@@ -14506,9 +14506,10 @@ 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 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.
+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:
""""""""""
@@ -14520,9 +14521,10 @@ name of the entity being instrumented. This should generally be the
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 not used.
+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 bit index into the global test vector bitmap
+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
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 1ac4a5f..9010e1a 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -33,7 +33,6 @@
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
#include <optional>
@@ -1581,16 +1580,10 @@ public:
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
- /// \return The number of bits used for the MCDC bitmaps for the instrumented
- /// function.
- ConstantInt *getNumBitmapBits() const {
- return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
- }
-
/// \return The number of bytes used for the MCDC bitmaps for the instrumented
/// function.
- auto getNumBitmapBytes() const {
- return alignTo(getNumBitmapBits()->getZExtValue(), CHAR_BIT) / CHAR_BIT;
+ ConstantInt *getNumBitmapBytes() const {
+ return cast<ConstantInt>(const_cast<Value *>(getArgOperand(2)));
}
};
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index 5fc497d..da03104 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -677,8 +677,7 @@ public:
/// pairs.
Expected<MCDCRecord>
evaluateMCDCRegion(const CounterMappingRegion &Region,
- ArrayRef<const CounterMappingRegion *> Branches,
- bool IsVersion11);
+ ArrayRef<const CounterMappingRegion *> Branches);
unsigned getMaxCounterID(const Counter &C) const;
};
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 0c899e6..5cd8c32 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -1161,7 +1161,7 @@ enum ProfVersion {
Version10 = 10,
// An additional field is used for bitmap bytes.
Version11 = 11,
- // VTable profiling, decision record and bitmap are modified for mcdc.
+ // VTable profiling,
Version12 = 12,
// The current version is 12.
CurrentVersion = INSTR_PROF_INDEX_VERSION
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 455124e..8c81bbe8 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -384,18 +384,15 @@ class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder {
DenseSet<unsigned> TVIdxs;
#endif
- bool IsVersion11;
-
public:
MCDCRecordProcessor(const BitVector &Bitmap,
const CounterMappingRegion &Region,
- ArrayRef<const CounterMappingRegion *> Branches,
- bool IsVersion11)
+ ArrayRef<const CounterMappingRegion *> Branches)
: NextIDsBuilder(Branches), TVIdxBuilder(this->NextIDs), Bitmap(Bitmap),
Region(Region), DecisionParams(Region.getDecisionParams()),
Branches(Branches), NumConditions(DecisionParams.NumConditions),
Folded(NumConditions, false), IndependencePairs(NumConditions),
- ExecVectors(ExecVectorsByCond[false]), IsVersion11(IsVersion11) {}
+ ExecVectors(ExecVectorsByCond[false]) {}
private:
// Walk the binary decision diagram and try assigning both false and true to
@@ -418,9 +415,7 @@ private:
assert(TVIdx < SavedNodes[ID].Width);
assert(TVIdxs.insert(NextTVIdx).second && "Duplicate TVIdx");
- if (!Bitmap[IsVersion11
- ? DecisionParams.BitmapIdx * CHAR_BIT + TV.getIndex()
- : DecisionParams.BitmapIdx - NumTestVectors + NextTVIdx])
+ if (!Bitmap[DecisionParams.BitmapIdx * CHAR_BIT + TV.getIndex()])
continue;
// Copy the completed test vector to the vector of testvectors.
@@ -526,9 +521,9 @@ public:
Expected<MCDCRecord> CounterMappingContext::evaluateMCDCRegion(
const CounterMappingRegion &Region,
- ArrayRef<const CounterMappingRegion *> Branches, bool IsVersion11) {
+ ArrayRef<const CounterMappingRegion *> Branches) {
- MCDCRecordProcessor MCDCProcessor(Bitmap, Region, Branches, IsVersion11);
+ MCDCRecordProcessor MCDCProcessor(Bitmap, Region, Branches);
return MCDCProcessor.processMCDCRecord();
}
@@ -615,8 +610,8 @@ static unsigned getMaxCounterID(const CounterMappingContext &Ctx,
}
/// Returns the bit count
-static unsigned getMaxBitmapSize(const CoverageMappingRecord &Record,
- bool IsVersion11) {
+static unsigned getMaxBitmapSize(const CounterMappingContext &Ctx,
+ const CoverageMappingRecord &Record) {
unsigned MaxBitmapIdx = 0;
unsigned NumConditions = 0;
// Scan max(BitmapIdx).
@@ -631,12 +626,8 @@ static unsigned getMaxBitmapSize(const CoverageMappingRecord &Record,
NumConditions = DecisionParams.NumConditions;
}
}
-
- if (IsVersion11)
- MaxBitmapIdx = MaxBitmapIdx * CHAR_BIT +
- llvm::alignTo(uint64_t(1) << NumConditions, CHAR_BIT);
-
- return MaxBitmapIdx;
+ unsigned SizeInBits = llvm::alignTo(uint64_t(1) << NumConditions, CHAR_BIT);
+ return MaxBitmapIdx * CHAR_BIT + SizeInBits;
}
namespace {
@@ -824,9 +815,6 @@ Error CoverageMapping::loadFunctionRecord(
}
Ctx.setCounts(Counts);
- bool IsVersion11 =
- ProfileReader.getVersion() < IndexedInstrProf::ProfVersion::Version12;
-
BitVector Bitmap;
if (Error E = ProfileReader.getFunctionBitmap(Record.FunctionName,
Record.FunctionHash, Bitmap)) {
@@ -838,7 +826,7 @@ Error CoverageMapping::loadFunctionRecord(
}
if (IPE != instrprof_error::unknown_function)
return make_error<InstrProfError>(IPE);
- Bitmap = BitVector(getMaxBitmapSize(Record, IsVersion11));
+ Bitmap = BitVector(getMaxBitmapSize(Ctx, Record));
}
Ctx.setBitmap(std::move(Bitmap));
@@ -896,7 +884,7 @@ Error CoverageMapping::loadFunctionRecord(
// DecisionRegion, all of the information is now available to process.
// This is where the bulk of the MC/DC progressing takes place.
Expected<MCDCRecord> Record =
- Ctx.evaluateMCDCRegion(*MCDCDecision, MCDCBranches, IsVersion11);
+ Ctx.evaluateMCDCRegion(*MCDCDecision, MCDCBranches);
if (auto E = Record.takeError()) {
consumeError(std::move(E));
return Error::success();
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 0c79eaa..f9b58d9 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -936,6 +936,9 @@ Value *InstrLowerer::getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I) {
auto *Bitmaps = getOrCreateRegionBitmaps(I);
IRBuilder<> Builder(I);
+ auto *Addr = Builder.CreateConstInBoundsGEP2_32(
+ Bitmaps->getValueType(), Bitmaps, 0, I->getBitmapIndex()->getZExtValue());
+
if (isRuntimeCounterRelocationEnabled()) {
LLVMContext &Ctx = M.getContext();
Ctx.diagnose(DiagnosticInfoPGOProfile(
@@ -945,7 +948,7 @@ Value *InstrLowerer::getBitmapAddress(InstrProfMCDCTVBitmapUpdate *I) {
DS_Warning));
}
- return Bitmaps;
+ return Addr;
}
void InstrLowerer::lowerCover(InstrProfCoverInst *CoverInstruction) {
@@ -1015,11 +1018,9 @@ void InstrLowerer::lowerMCDCTestVectorBitmapUpdate(
auto *MCDCCondBitmapAddr = Update->getMCDCCondBitmapAddr();
auto *BitmapAddr = getBitmapAddress(Update);
- // Load Temp Val + BitmapIdx.
+ // Load Temp Val.
// %mcdc.temp = load i32, ptr %mcdc.addr, align 4
- auto *Temp = Builder.CreateAdd(
- Builder.CreateLoad(Int32Ty, MCDCCondBitmapAddr, "mcdc.temp"),
- Update->getBitmapIndex());
+ auto *Temp = Builder.CreateLoad(Int32Ty, MCDCCondBitmapAddr, "mcdc.temp");
// Calculate byte offset using div8.
// %1 = lshr i32 %mcdc.temp, 3
@@ -1414,7 +1415,7 @@ GlobalVariable *
InstrLowerer::createRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc,
StringRef Name,
GlobalValue::LinkageTypes Linkage) {
- uint64_t NumBytes = Inc->getNumBitmapBytes();
+ uint64_t NumBytes = Inc->getNumBitmapBytes()->getZExtValue();
auto *BitmapTy = ArrayType::get(Type::getInt8Ty(M.getContext()), NumBytes);
auto GV = new GlobalVariable(M, BitmapTy, false, Linkage,
Constant::getNullValue(BitmapTy), Name);
@@ -1433,7 +1434,7 @@ InstrLowerer::getOrCreateRegionBitmaps(InstrProfMCDCBitmapInstBase *Inc) {
// the corresponding profile section.
auto *BitmapPtr = setupProfileSection(Inc, IPSK_bitmap);
PD.RegionBitmaps = BitmapPtr;
- PD.NumBitmapBytes = Inc->getNumBitmapBytes();
+ PD.NumBitmapBytes = Inc->getNumBitmapBytes()->getZExtValue();
return PD.RegionBitmaps;
}
diff --git a/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll b/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll
index 4561031..7c064f5 100644
--- a/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/inline-data-var-create.ll
@@ -27,21 +27,21 @@ declare void @llvm.instrprof.mcdc.parameters(ptr %0, i64 %1, i32 %2)
define internal void @foobar() {
call void @llvm.instrprof.increment(ptr @__profn_foobar, i64 123456, i32 32, i32 0)
- call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foobar, i64 123456, i32 792)
+ call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foobar, i64 123456, i32 99)
ret void
}
define void @foo() {
call void @llvm.instrprof.increment(ptr @__profn_foo, i64 123456, i32 32, i32 0)
- call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foo, i64 123456, i32 168)
+ call void @llvm.instrprof.mcdc.parameters(ptr @__profn_foo, i64 123456, i32 21)
call void @foobar()
ret void
}
define void @bar() {
call void @llvm.instrprof.increment(ptr @__profn_bar, i64 123456, i32 32, i32 0)
- call void @llvm.instrprof.mcdc.parameters(ptr @__profn_bar, i64 123456, i32 184)
+ call void @llvm.instrprof.mcdc.parameters(ptr @__profn_bar, i64 123456, i32 23)
call void @foobar()
ret void
}
diff --git a/llvm/test/Instrumentation/InstrProfiling/mcdc.ll b/llvm/test/Instrumentation/InstrProfiling/mcdc.ll
index e9ae808..a7f1e60 100644
--- a/llvm/test/Instrumentation/InstrProfiling/mcdc.ll
+++ b/llvm/test/Instrumentation/InstrProfiling/mcdc.ll
@@ -30,8 +30,7 @@ entry:
; CHECK-NEXT: store i32 %[[LAB3]], ptr %mcdc.addr, align 4
call void @llvm.instrprof.mcdc.tvbitmap.update(ptr @__profn_test, i64 99278, i32 1, i32 0, ptr %mcdc.addr)
- ; CHECK: %[[TEMP0:mcdc.*]] = load i32, ptr %mcdc.addr, align 4
- ; CHECK-NEXT: %[[TEMP:[0-9]+]] = add i32 %[[TEMP0]], 0
+ ; CHECK: %[[TEMP:mcdc.*]] = load i32, ptr %mcdc.addr, align 4
; CHECK-NEXT: %[[LAB4:[0-9]+]] = lshr i32 %[[TEMP]], 3
; CHECK-NEXT: %[[LAB7:[0-9]+]] = getelementptr inbounds i8, ptr @__profbm_test, i32 %[[LAB4]]
; CHECK-NEXT: %[[LAB8:[0-9]+]] = and i32 %[[TEMP]], 7
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o
index 7a16162..4f54fa7 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.o
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext
index 97d78a3..82335a8 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const-folding.proftext
@@ -40,7 +40,7 @@ _Z5case2b
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x6
+0xa
_Z5case3b
@@ -55,7 +55,7 @@ _Z5case3b
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x5
+0x9
_Z5case4b
@@ -70,7 +70,7 @@ _Z5case4b
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x1
+0x2
_Z5case5b
@@ -85,7 +85,7 @@ _Z5case5b
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x5
+0x6
_Z5case6b
@@ -100,7 +100,7 @@ _Z5case6b
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x6
+0x5
_Z5case7b
@@ -166,7 +166,7 @@ _Z5caseabb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0xe
+0xa2
_Z5casebbb
@@ -183,7 +183,7 @@ _Z5casebbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0xd
+0xa1
_Z5casecbb
@@ -200,7 +200,7 @@ _Z5casecbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x1
+0x2
_Z5casedbb
@@ -217,7 +217,7 @@ _Z5casedbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x3
+0x12
_Z5caseebb
@@ -234,7 +234,7 @@ _Z5caseebb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0xa
+0x14
_Z5casefbb
@@ -251,7 +251,7 @@ _Z5casefbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x9
+0x6
_Z5casegbb
@@ -268,7 +268,7 @@ _Z5casegbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x7
+0x23
_Z5casehbb
@@ -302,7 +302,7 @@ _Z5caseibb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0xb
+0x83
_Z5casejbb
@@ -319,7 +319,7 @@ _Z5casejbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0xd
+0xa1
_Z5casekbb
@@ -336,7 +336,7 @@ _Z5casekbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x3
+0x12
_Z5caselbb
@@ -353,7 +353,7 @@ _Z5caselbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x3
+0x12
_Z5casembb
@@ -370,7 +370,7 @@ _Z5casembb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x3
+0x12
_Z5casenbb
@@ -387,7 +387,7 @@ _Z5casenbb
# Num Bitmap Bytes:
$1
# Bitmap Byte Values:
-0x9
+0x6
main
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o
index bc38b71..1145fcc 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.o
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext
index 16eba3a..10253f2 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-const.proftext
@@ -14,10 +14,12 @@ _Z4testbbbb
0
0
# Num Bitmap Bytes:
-$2
+$4
# Bitmap Byte Values:
0x1
-0x4
+0x2
+0x0
+0x0
main
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o
deleted file mode 100644
index e802f51..0000000
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.o
+++ /dev/null
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata b/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata
deleted file mode 100644
index d351096..0000000
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-general-18.profdata
+++ /dev/null
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o
index 8bed601..e802f51 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-general.o
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-general.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-general.proftext
index 2faca9d..a83f036 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-general.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-general.proftext
@@ -24,11 +24,14 @@ _Z4testbbbb
2
1
# Num Bitmap Bytes:
-$3
+$6
# Bitmap Byte Values:
-0xef
-0x77
-0x3
+0x2f
+0x8
+0xb
+0x9
+0x83
+0x80
main
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o
index 5b39348..c0a9d60 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.o
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext
index 44057ff..35ecc42 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-macro.proftext
@@ -27,12 +27,21 @@ func
0
0
# Num Bitmap Bytes:
-$4
+$13
# Bitmap Byte Values:
0x0
-0x9
0x0
-0x1
+0x0
+0x20
+0x8
+0x0
+0x20
+0x0
+0x0
+0x0
+0x0
+0x0
+0x0
func1
diff --git a/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o b/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o
index 21f9d3a..bc993b1 100644
--- a/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o
+++ b/llvm/test/tools/llvm-cov/Inputs/mcdc-maxbs.o
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/mcdc-general-18.test b/llvm/test/tools/llvm-cov/mcdc-general-18.test
deleted file mode 100644
index 8707238..0000000
--- a/llvm/test/tools/llvm-cov/mcdc-general-18.test
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test Version11 (clang-18) files.
-// mcdc-general.test is used as test patterns.
-
-// RUN: llvm-cov show --show-mcdc %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/mcdc-general.test
-// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=REPORT
-
-// Turn off MC/DC visualization.
-// RUN: llvm-cov show %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/mcdc-general.test -check-prefix=NOMCDC
-
-// Turn off MC/DC summary.
-// RUN: llvm-cov report %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=REPORT_NOMCDC
-
-// Test file-level report.
-// RUN: llvm-cov report --show-mcdc-summary %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs %S/Inputs/mcdc-general.cpp | FileCheck %S/mcdc-general.test -check-prefix=FILEREPORT
-
-// Test html output.
-// RUN: rm -rf %t.html.dir
-// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general-18.o -instr-profile %S/Inputs/mcdc-general-18.profdata -path-equivalence=.,%S/Inputs -format html -o %t.html.dir
-// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/mcdc-general.cpp.html %S/mcdc-general.test
-// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %S/mcdc-general.test
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index ef14767..f063a33 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -872,7 +872,7 @@ TEST_P(CoverageMappingTest, non_code_region_bitmask) {
addCMR(Counter::getCounter(2), "file", 1, 1, 5, 5);
addCMR(Counter::getCounter(3), "file", 1, 1, 5, 5);
- addMCDCDecisionCMR(3, 2, "file", 7, 1, 7, 6);
+ addMCDCDecisionCMR(0, 2, "file", 7, 1, 7, 6);
addMCDCBranchCMR(Counter::getCounter(0), Counter::getCounter(1), 0, {-1, 1},
"file", 7, 2, 7, 3);
addMCDCBranchCMR(Counter::getCounter(2), Counter::getCounter(3), 1, {-1, -1},
@@ -895,7 +895,7 @@ TEST_P(CoverageMappingTest, decision_before_expansion) {
addCMR(Counter::getCounter(0), "foo", 3, 23, 5, 2);
// This(4:11) was put after Expansion(4:11) before the fix
- addMCDCDecisionCMR(3, 2, "foo", 4, 11, 4, 20);
+ addMCDCDecisionCMR(0, 2, "foo", 4, 11, 4, 20);
addExpansionCMR("foo", "A", 4, 11, 4, 12);
addExpansionCMR("foo", "B", 4, 19, 4, 20);