[llvm] r365839 - [sancov] Ignore PC samples with value 0

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 15:59:23 PDT 2019


Author: phosek
Date: Thu Jul 11 15:59:23 2019
New Revision: 365839

URL: http://llvm.org/viewvc/llvm-project?rev=365839&view=rev
Log:
[sancov] Ignore PC samples with value 0

The sancov runtime for the (Fuchsia) Zircon kernel delivers results
in the standard format, but as the full array of possible samples
with 0 in uncovered slots. That runtime delivers "live" data and
has no final "export" pass to compactify out the uncovered slots,
and it seems silly to require another offline tool just for that.

Patch By: mcgrathr
Differential Revision: https://reviews.llvm.org/D63695

Modified:
    llvm/trunk/tools/sancov/sancov.cpp

Modified: llvm/trunk/tools/sancov/sancov.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/sancov/sancov.cpp?rev=365839&r1=365838&r2=365839&view=diff
==============================================================================
--- llvm/trunk/tools/sancov/sancov.cpp (original)
+++ llvm/trunk/tools/sancov/sancov.cpp Thu Jul 11 15:59:23 2019
@@ -259,6 +259,10 @@ RawCoverage::read(const std::string &Fil
     return make_error_code(errc::illegal_byte_sequence);
   }
 
+  // Ignore slots that are zero, so a runtime implementation is not required
+  // to compactify the data.
+  Addrs->erase(0);
+
   return std::unique_ptr<RawCoverage>(new RawCoverage(std::move(Addrs)));
 }
 
@@ -1229,7 +1233,7 @@ int main(int Argc, char **Argv) {
   llvm::InitializeAllTargetMCs();
   llvm::InitializeAllDisassemblers();
 
-  cl::ParseCommandLineOptions(Argc, Argv, 
+  cl::ParseCommandLineOptions(Argc, Argv,
       "Sanitizer Coverage Processing Tool (sancov)\n\n"
       "  This tool can extract various coverage-related information from: \n"
       "  coverage-instrumented binary files, raw .sancov files and their "




More information about the llvm-commits mailing list