forked from OSchip/llvm-project
InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't used
It's not entirely clear to me what this field was meant for, but it's always false. Remove it. llvm-svn: 228034
This commit is contained in:
parent
a4a77ed59e
commit
de15817ea2
|
@ -158,24 +158,17 @@ struct CounterMappingRegion {
|
||||||
SkippedRegion
|
SkippedRegion
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned EncodingHasCodeBeforeBits = 1;
|
|
||||||
|
|
||||||
Counter Count;
|
Counter Count;
|
||||||
unsigned FileID, ExpandedFileID;
|
unsigned FileID, ExpandedFileID;
|
||||||
unsigned LineStart, ColumnStart, LineEnd, ColumnEnd;
|
unsigned LineStart, ColumnStart, LineEnd, ColumnEnd;
|
||||||
RegionKind Kind;
|
RegionKind Kind;
|
||||||
/// \brief A flag that is set to true when there is already code before
|
|
||||||
/// this region on the same line.
|
|
||||||
/// This is useful to accurately compute the execution counts for a line.
|
|
||||||
bool HasCodeBefore;
|
|
||||||
|
|
||||||
CounterMappingRegion(Counter Count, unsigned FileID, unsigned LineStart,
|
CounterMappingRegion(Counter Count, unsigned FileID, unsigned LineStart,
|
||||||
unsigned ColumnStart, unsigned LineEnd,
|
unsigned ColumnStart, unsigned LineEnd,
|
||||||
unsigned ColumnEnd, bool HasCodeBefore = false,
|
unsigned ColumnEnd, RegionKind Kind = CodeRegion)
|
||||||
RegionKind Kind = CodeRegion)
|
|
||||||
: Count(Count), FileID(FileID), ExpandedFileID(0), LineStart(LineStart),
|
: Count(Count), FileID(FileID), ExpandedFileID(0), LineStart(LineStart),
|
||||||
ColumnStart(ColumnStart), LineEnd(LineEnd), ColumnEnd(ColumnEnd),
|
ColumnStart(ColumnStart), LineEnd(LineEnd), ColumnEnd(ColumnEnd),
|
||||||
Kind(Kind), HasCodeBefore(HasCodeBefore) {}
|
Kind(Kind) {}
|
||||||
|
|
||||||
inline std::pair<unsigned, unsigned> startLoc() const {
|
inline std::pair<unsigned, unsigned> startLoc() const {
|
||||||
return std::pair<unsigned, unsigned>(LineStart, ColumnStart);
|
return std::pair<unsigned, unsigned>(LineStart, ColumnStart);
|
||||||
|
|
|
@ -173,15 +173,12 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the source range.
|
// Read the source range.
|
||||||
uint64_t LineStartDelta, CodeBeforeColumnStart, NumLines, ColumnEnd;
|
uint64_t LineStartDelta, ColumnStart, NumLines, ColumnEnd;
|
||||||
if (auto Err =
|
if (auto Err =
|
||||||
readIntMax(LineStartDelta, std::numeric_limits<unsigned>::max()))
|
readIntMax(LineStartDelta, std::numeric_limits<unsigned>::max()))
|
||||||
return Err;
|
return Err;
|
||||||
if (auto Err = readULEB128(CodeBeforeColumnStart))
|
if (auto Err = readULEB128(ColumnStart))
|
||||||
return Err;
|
return Err;
|
||||||
bool HasCodeBefore = CodeBeforeColumnStart & 1;
|
|
||||||
uint64_t ColumnStart = CodeBeforeColumnStart >>
|
|
||||||
CounterMappingRegion::EncodingHasCodeBeforeBits;
|
|
||||||
if (ColumnStart > std::numeric_limits<unsigned>::max())
|
if (ColumnStart > std::numeric_limits<unsigned>::max())
|
||||||
return error(instrprof_error::malformed);
|
return error(instrprof_error::malformed);
|
||||||
if (auto Err = readIntMax(NumLines, std::numeric_limits<unsigned>::max()))
|
if (auto Err = readIntMax(NumLines, std::numeric_limits<unsigned>::max()))
|
||||||
|
@ -213,9 +210,9 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray(
|
||||||
dbgs() << "\n";
|
dbgs() << "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
MappingRegions.push_back(CounterMappingRegion(
|
MappingRegions.push_back(
|
||||||
C, InferredFileID, LineStart, ColumnStart, LineStart + NumLines,
|
CounterMappingRegion(C, InferredFileID, LineStart, ColumnStart,
|
||||||
ColumnEnd, HasCodeBefore, Kind));
|
LineStart + NumLines, ColumnEnd, Kind));
|
||||||
MappingRegions.back().ExpandedFileID = ExpandedFileID;
|
MappingRegions.back().ExpandedFileID = ExpandedFileID;
|
||||||
}
|
}
|
||||||
return success();
|
return success();
|
||||||
|
|
|
@ -172,11 +172,7 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
|
||||||
}
|
}
|
||||||
assert(I->LineStart >= PrevLineStart);
|
assert(I->LineStart >= PrevLineStart);
|
||||||
encodeULEB128(I->LineStart - PrevLineStart, OS);
|
encodeULEB128(I->LineStart - PrevLineStart, OS);
|
||||||
uint64_t CodeBeforeColumnStart =
|
encodeULEB128(I->ColumnStart, OS);
|
||||||
uint64_t(I->HasCodeBefore) |
|
|
||||||
(uint64_t(I->ColumnStart)
|
|
||||||
<< CounterMappingRegion::EncodingHasCodeBeforeBits);
|
|
||||||
encodeULEB128(CodeBeforeColumnStart, OS);
|
|
||||||
assert(I->LineEnd >= I->LineStart);
|
assert(I->LineEnd >= I->LineStart);
|
||||||
encodeULEB128(I->LineEnd - I->LineStart, OS);
|
encodeULEB128(I->LineEnd - I->LineStart, OS);
|
||||||
encodeULEB128(I->ColumnEnd, OS);
|
encodeULEB128(I->ColumnEnd, OS);
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
void func() {
|
void func() {
|
||||||
return;
|
return;
|
||||||
int i = 0; // CHECK: Highlighted line [[@LINE]], 3 -> 12
|
int i = 0; // CHECK: Highlighted line [[@LINE]], 3 -> ?
|
||||||
}
|
} // CHECK: Highlighted line [[@LINE]], 1 -> 2
|
||||||
|
|
||||||
void func2(int x) {
|
void func2(int x) {
|
||||||
if(x > 5) {
|
if(x > 5) {
|
||||||
while(x >= 9) {
|
while(x >= 9) {
|
||||||
return;
|
return;
|
||||||
--x; // CHECK: Highlighted line [[@LINE]], 7 -> 10
|
--x; // CHECK: Highlighted line [[@LINE]], 7 -> ?
|
||||||
}
|
} // CHECK: Highlighted line [[@LINE]], 1 -> 6
|
||||||
int i = 0; // CHECK: Highlighted line [[@LINE]], 5 -> 14
|
int i = 0; // CHECK: Highlighted line [[@LINE]], 5 -> ?
|
||||||
}
|
} // CHECK: Highlighted line [[@LINE]], 1 -> 4
|
||||||
}
|
}
|
||||||
|
|
||||||
void test() {
|
void test() {
|
||||||
|
|
Loading…
Reference in New Issue