From de15817ea20f021f23b47fe0c42317b98302eecc Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 3 Feb 2015 21:35:36 +0000 Subject: [PATCH] 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 --- llvm/include/llvm/ProfileData/CoverageMapping.h | 11 ++--------- llvm/lib/ProfileData/CoverageMappingReader.cpp | 13 +++++-------- llvm/lib/ProfileData/CoverageMappingWriter.cpp | 6 +----- .../tools/llvm-cov/Inputs/highlightedRanges.covmapping | Bin 355 -> 355 bytes .../test/tools/llvm-cov/Inputs/regionMarkers.covmapping | Bin 194 -> 202 bytes .../tools/llvm-cov/Inputs/showExpansions.covmapping | Bin 194 -> 250 bytes llvm/test/tools/llvm-cov/showHighlightedRanges.cpp | 12 ++++++------ 7 files changed, 14 insertions(+), 28 deletions(-) diff --git a/llvm/include/llvm/ProfileData/CoverageMapping.h b/llvm/include/llvm/ProfileData/CoverageMapping.h index 7c88977..61aad3b 100644 --- a/llvm/include/llvm/ProfileData/CoverageMapping.h +++ b/llvm/include/llvm/ProfileData/CoverageMapping.h @@ -158,24 +158,17 @@ struct CounterMappingRegion { SkippedRegion }; - static const unsigned EncodingHasCodeBeforeBits = 1; - Counter Count; unsigned FileID, ExpandedFileID; unsigned LineStart, ColumnStart, LineEnd, ColumnEnd; 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, unsigned ColumnStart, unsigned LineEnd, - unsigned ColumnEnd, bool HasCodeBefore = false, - RegionKind Kind = CodeRegion) + unsigned ColumnEnd, RegionKind Kind = CodeRegion) : Count(Count), FileID(FileID), ExpandedFileID(0), LineStart(LineStart), ColumnStart(ColumnStart), LineEnd(LineEnd), ColumnEnd(ColumnEnd), - Kind(Kind), HasCodeBefore(HasCodeBefore) {} + Kind(Kind) {} inline std::pair startLoc() const { return std::pair(LineStart, ColumnStart); diff --git a/llvm/lib/ProfileData/CoverageMappingReader.cpp b/llvm/lib/ProfileData/CoverageMappingReader.cpp index 71ce22a..423947d 100644 --- a/llvm/lib/ProfileData/CoverageMappingReader.cpp +++ b/llvm/lib/ProfileData/CoverageMappingReader.cpp @@ -173,15 +173,12 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray( } // Read the source range. - uint64_t LineStartDelta, CodeBeforeColumnStart, NumLines, ColumnEnd; + uint64_t LineStartDelta, ColumnStart, NumLines, ColumnEnd; if (auto Err = readIntMax(LineStartDelta, std::numeric_limits::max())) return Err; - if (auto Err = readULEB128(CodeBeforeColumnStart)) + if (auto Err = readULEB128(ColumnStart)) return Err; - bool HasCodeBefore = CodeBeforeColumnStart & 1; - uint64_t ColumnStart = CodeBeforeColumnStart >> - CounterMappingRegion::EncodingHasCodeBeforeBits; if (ColumnStart > std::numeric_limits::max()) return error(instrprof_error::malformed); if (auto Err = readIntMax(NumLines, std::numeric_limits::max())) @@ -213,9 +210,9 @@ std::error_code RawCoverageMappingReader::readMappingRegionsSubArray( dbgs() << "\n"; }); - MappingRegions.push_back(CounterMappingRegion( - C, InferredFileID, LineStart, ColumnStart, LineStart + NumLines, - ColumnEnd, HasCodeBefore, Kind)); + MappingRegions.push_back( + CounterMappingRegion(C, InferredFileID, LineStart, ColumnStart, + LineStart + NumLines, ColumnEnd, Kind)); MappingRegions.back().ExpandedFileID = ExpandedFileID; } return success(); diff --git a/llvm/lib/ProfileData/CoverageMappingWriter.cpp b/llvm/lib/ProfileData/CoverageMappingWriter.cpp index 6969c2a..aef5511 100644 --- a/llvm/lib/ProfileData/CoverageMappingWriter.cpp +++ b/llvm/lib/ProfileData/CoverageMappingWriter.cpp @@ -172,11 +172,7 @@ void CoverageMappingWriter::write(raw_ostream &OS) { } assert(I->LineStart >= PrevLineStart); encodeULEB128(I->LineStart - PrevLineStart, OS); - uint64_t CodeBeforeColumnStart = - uint64_t(I->HasCodeBefore) | - (uint64_t(I->ColumnStart) - << CounterMappingRegion::EncodingHasCodeBeforeBits); - encodeULEB128(CodeBeforeColumnStart, OS); + encodeULEB128(I->ColumnStart, OS); assert(I->LineEnd >= I->LineStart); encodeULEB128(I->LineEnd - I->LineStart, OS); encodeULEB128(I->ColumnEnd, OS); diff --git a/llvm/test/tools/llvm-cov/Inputs/highlightedRanges.covmapping b/llvm/test/tools/llvm-cov/Inputs/highlightedRanges.covmapping index 20eb0d7e8df5b91054e61fd3508b1cbff05e640b..e97320b7855d167054b5fccccd4b703f75b31482 100644 GIT binary patch delta 254 zcmYL^y^6w65QXPV?oD!|S4^@CK@d|Y*rm3yk!34OAHbimjc&jM!FKCy@+K*5EqxAO z#8D9kzL~>0rRrU z3Jt}MOYFgAaTQ2G!@wd85ZMpbPQZ#;mZxJ%4E3mQXu!&`2C3!k7!lOc}+m%@0$+M2LpmNL>AB7+Yk1_dimrLw~*-U5=zA0~N$D3A2>O8f&c CVjQ3V diff --git a/llvm/test/tools/llvm-cov/Inputs/regionMarkers.covmapping b/llvm/test/tools/llvm-cov/Inputs/regionMarkers.covmapping index 3ebcb0777af316534f4ba725d7400f00e741f55e..501cba2b734ad5e90a1055b5247b784cf6ea993a 100644 GIT binary patch delta 150 zcmX@ac#1JBC#NhoIlnBoB(=CCC9x!tWy8US27%nf%sfU01_oy!b_HS(*r33`01{&X zVml!Ab=ClqKru)C(BjmhV*RB2^t{v}{p9?V)QSGK<~$-ytjt_YEKE#5f}K^EL5h<> jhC!Z_L6M1tmqmaqyXuh6Sc)!jk| zzJZy;OxNA|THkux8rxL1qQ}qu{?b>M0RiCPm>gb@4S?^+VI9wpt?(K5>eIAWqfYv3 zXs@c)O{+RLtNf<2T6g9zzq=o0&ieZ}jn!Z-dN8|s9Q__hWR5tJsZ2}Bk&@->zZ2$L z3It}bWLUvEMuwDG3QkH0ndZR^7At4-5@V1;lE5T`5GnJS@|h4x0imEbj4><%SNh9e DK_4q? literal 194 zcmWlSO$x#=6olusc}k=a#lKdC2#UC}F1>(zuMn$f!L)@Ib?MdIy7EXS1K+?519QJW zY*s#ObE%uNX^i-N-tV3@c|iaY$JOEWTL8Wjj+5iN+k`&TByDV!*0=I`cvYsT^RlS7 zSylNVBr!{tTCtodJz}Z)Oyi>nLRw?W*h5FuL0@Bqfne1FYecN(K^O7R*)Z(3T{%V+ Rs)S-{1xmQQL`2FT;18Kf8+ZT! diff --git a/llvm/test/tools/llvm-cov/showHighlightedRanges.cpp b/llvm/test/tools/llvm-cov/showHighlightedRanges.cpp index cec7308..1ff7929 100644 --- a/llvm/test/tools/llvm-cov/showHighlightedRanges.cpp +++ b/llvm/test/tools/llvm-cov/showHighlightedRanges.cpp @@ -2,17 +2,17 @@ void func() { 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) { if(x > 5) { while(x >= 9) { return; - --x; // CHECK: Highlighted line [[@LINE]], 7 -> 10 - } - int i = 0; // CHECK: Highlighted line [[@LINE]], 5 -> 14 - } + --x; // CHECK: Highlighted line [[@LINE]], 7 -> ? + } // CHECK: Highlighted line [[@LINE]], 1 -> 6 + int i = 0; // CHECK: Highlighted line [[@LINE]], 5 -> ? + } // CHECK: Highlighted line [[@LINE]], 1 -> 4 } void test() { -- 2.7.4