aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp34
1 files changed, 11 insertions, 23 deletions
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();