[llvm] r228034 - InstrProf: Remove CoverageMapping::HasCodeBefore, it isn't used

Justin Bogner mail at justinbogner.com
Tue Feb 3 13:35:36 PST 2015


Author: bogner
Date: Tue Feb  3 15:35:36 2015
New Revision: 228034

URL: http://llvm.org/viewvc/llvm-project?rev=228034&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
    llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
    llvm/trunk/lib/ProfileData/CoverageMappingWriter.cpp
    llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.covmapping
    llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.covmapping
    llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.covmapping
    llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp

Modified: llvm/trunk/include/llvm/ProfileData/CoverageMapping.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/CoverageMapping.h?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/CoverageMapping.h (original)
+++ llvm/trunk/include/llvm/ProfileData/CoverageMapping.h Tue Feb  3 15:35:36 2015
@@ -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<unsigned, unsigned> startLoc() const {
     return std::pair<unsigned, unsigned>(LineStart, ColumnStart);

Modified: llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingReader.cpp Tue Feb  3 15:35:36 2015
@@ -173,15 +173,12 @@ std::error_code RawCoverageMappingReader
     }
 
     // Read the source range.
-    uint64_t LineStartDelta, CodeBeforeColumnStart, NumLines, ColumnEnd;
+    uint64_t LineStartDelta, ColumnStart, NumLines, ColumnEnd;
     if (auto Err =
             readIntMax(LineStartDelta, std::numeric_limits<unsigned>::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<unsigned>::max())
       return error(instrprof_error::malformed);
     if (auto Err = readIntMax(NumLines, std::numeric_limits<unsigned>::max()))
@@ -213,9 +210,9 @@ std::error_code RawCoverageMappingReader
       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();

Modified: llvm/trunk/lib/ProfileData/CoverageMappingWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/CoverageMappingWriter.cpp?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/CoverageMappingWriter.cpp (original)
+++ llvm/trunk/lib/ProfileData/CoverageMappingWriter.cpp Tue Feb  3 15:35:36 2015
@@ -172,11 +172,7 @@ void CoverageMappingWriter::write(raw_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);

Modified: llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.covmapping
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/highlightedRanges.covmapping?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.covmapping
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/regionMarkers.covmapping?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
Binary files - no diff available.

Modified: llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.covmapping
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.covmapping?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
Binary files llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.covmapping (original) and llvm/trunk/test/tools/llvm-cov/Inputs/showExpansions.covmapping Tue Feb  3 15:35:36 2015 differ

Modified: llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp?rev=228034&r1=228033&r2=228034&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp (original)
+++ llvm/trunk/test/tools/llvm-cov/showHighlightedRanges.cpp Tue Feb  3 15:35:36 2015
@@ -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() {





More information about the llvm-commits mailing list