[compiler-rt] r300780 - [sanitizer-coverage] remove more unused code

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 19 16:05:54 PDT 2017


Author: kcc
Date: Wed Apr 19 18:05:53 2017
New Revision: 300780

URL: http://llvm.org/viewvc/llvm-project?rev=300780&view=rev
Log:
[sanitizer-coverage] remove more unused code

Removed:
    compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc
Modified:
    compiler-rt/trunk/include/sanitizer/coverage_interface.h
    compiler-rt/trunk/lib/dfsan/done_abilist.txt
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_interface.inc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc

Modified: compiler-rt/trunk/include/sanitizer/coverage_interface.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/sanitizer/coverage_interface.h?rev=300780&r1=300779&r2=300780&view=diff
==============================================================================
--- compiler-rt/trunk/include/sanitizer/coverage_interface.h (original)
+++ compiler-rt/trunk/include/sanitizer/coverage_interface.h Wed Apr 19 18:05:53 2017
@@ -35,14 +35,6 @@ extern "C" {
   // Get the number of unique covered blocks (or edges).
   // This can be useful for coverage-directed in-process fuzzers.
   uintptr_t __sanitizer_get_total_unique_coverage();
-
-  // Reset the basic-block (edge) coverage to the initial state.
-  // Useful for in-process fuzzing to start collecting coverage from scratch.
-  // Experimental, will likely not work for multi-threaded process.
-  void __sanitizer_reset_coverage();
-  // Set *data to the array of covered PCs and return the size of that array.
-  // Some of the entries in *data will be zero.
-  uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data);
 #ifdef __cplusplus
 }  // extern "C"
 #endif

Modified: compiler-rt/trunk/lib/dfsan/done_abilist.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/done_abilist.txt?rev=300780&r1=300779&r2=300780&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/done_abilist.txt (original)
+++ compiler-rt/trunk/lib/dfsan/done_abilist.txt Wed Apr 19 18:05:53 2017
@@ -285,14 +285,8 @@ fun:__sanitizer_cov_module_init=uninstru
 fun:__sanitizer_cov_module_init=discard
 fun:__sanitizer_cov_with_check=uninstrumented
 fun:__sanitizer_cov_with_check=discard
-fun:__sanitizer_reset_coverage=uninstrumented
-fun:__sanitizer_reset_coverage=discard
 fun:__sanitizer_set_death_callback=uninstrumented
 fun:__sanitizer_set_death_callback=discard
-fun:__sanitizer_get_coverage_guards=uninstrumented
-fun:__sanitizer_get_coverage_guards=discard
-fun:__sanitizer_get_total_unique_coverage=uninstrumented
-fun:__sanitizer_get_total_unique_coverage=discard
 fun:__sanitizer_get_total_unique_coverage=uninstrumented
 fun:__sanitizer_get_total_unique_coverage=discard
 fun:__sanitizer_update_counter_bitset_and_clear_counters=uninstrumented

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_interface.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_interface.inc?rev=300780&r1=300779&r2=300780&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_interface.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_interface.inc Wed Apr 19 18:05:53 2017
@@ -15,10 +15,8 @@ INTERFACE_FUNCTION(__sanitizer_cov_modul
 INTERFACE_FUNCTION(__sanitizer_cov_with_check)
 INTERFACE_FUNCTION(__sanitizer_dump_coverage)
 INTERFACE_FUNCTION(__sanitizer_dump_trace_pc_guard_coverage)
-INTERFACE_FUNCTION(__sanitizer_get_coverage_guards)
 INTERFACE_FUNCTION(__sanitizer_get_total_unique_coverage)
 INTERFACE_FUNCTION(__sanitizer_maybe_open_cov_file)
-INTERFACE_FUNCTION(__sanitizer_reset_coverage)
 INTERFACE_WEAK_FUNCTION(__sancov_default_options)
 INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp)
 INTERFACE_WEAK_FUNCTION(__sanitizer_cov_trace_cmp1)

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=300780&r1=300779&r2=300780&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Wed Apr 19 18:05:53 2017
@@ -58,10 +58,6 @@ static atomic_uint32_t dump_once_guard;
 
 static atomic_uintptr_t coverage_counter;
 
-static void ResetGlobalCounters() {
-  return atomic_store(&coverage_counter, 0, memory_order_relaxed);
-}
-
 // pc_array is the array containing the covered PCs.
 // To make the pc_array thread- and async-signal-safe it has to be large enough.
 // 128M counters "ought to be enough for anybody" (4M on 32-bit).
@@ -674,20 +670,6 @@ uptr __sanitizer_get_total_unique_covera
   return atomic_load(&coverage_counter, memory_order_relaxed);
 }
 
-SANITIZER_INTERFACE_ATTRIBUTE
-void __sanitizer_reset_coverage() {
-  ResetGlobalCounters();
-  coverage_data.ReinitializeGuards();
-  internal_bzero_aligned16(
-      coverage_data.data(),
-      RoundUpTo(coverage_data.size() * sizeof(coverage_data.data()[0]), 16));
-}
-SANITIZER_INTERFACE_ATTRIBUTE
-uptr __sanitizer_get_coverage_guards(uptr **data) {
-  *data = coverage_data.data();
-  return coverage_data.size();
-}
-
 // Default empty implementations (weak). Users should redefine them.
 SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_cmp, void) {}
 SANITIZER_INTERFACE_WEAK_DEF(void, __sanitizer_cov_trace_cmp1, void) {}

Removed: compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc?rev=300779&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/coverage-reset.cc (removed)
@@ -1,63 +0,0 @@
-// Test __sanitizer_reset_coverage().
-
-// RUN: %clangxx_asan -fsanitize-coverage=func %s -o %t
-// RUN: %env_asan_opts=coverage=1 %run %t
-
-// https://github.com/google/sanitizers/issues/618
-// UNSUPPORTED: android
-
-#include <sanitizer/coverage_interface.h>
-#include <stdio.h>
-#include <assert.h>
-static volatile int sink;
-__attribute__((noinline)) void bar() { sink = 2; }
-__attribute__((noinline)) void foo() { sink = 1; }
-
-// In MSVC 2015, printf is an inline function, which causes this test to fail as
-// it introduces an extra coverage point. Define away printf on that platform to
-// avoid the issue.
-#if _MSC_VER >= 1900
-# define printf(arg, ...)
-#endif
-
-#define GET_AND_PRINT_COVERAGE()                                       \
-  bitset = 0;                                                  \
-  for (size_t i = 0; i < n_guards; i++)                        \
-    if (guards[i]) bitset |= 1U << i;                          \
-  printf("line %d: bitset %zd total: %zd\n", __LINE__, bitset, \
-         __sanitizer_get_total_unique_coverage());
-
-#define IS_POWER_OF_TWO(a) ((a & ((a) - 1)) == 0)
-
-int main() {
-  size_t *guards = 0;
-  size_t bitset;
-  size_t n_guards = __sanitizer_get_coverage_guards(&guards);
-
-  GET_AND_PRINT_COVERAGE();
-  size_t main_bit = bitset;
-  assert(IS_POWER_OF_TWO(main_bit));
-
-  foo();
-  GET_AND_PRINT_COVERAGE();
-  size_t foo_bit = bitset & ~main_bit;
-  assert(IS_POWER_OF_TWO(foo_bit));
-
-  bar();
-  GET_AND_PRINT_COVERAGE();
-  size_t bar_bit = bitset & ~(main_bit | foo_bit);
-  assert(IS_POWER_OF_TWO(bar_bit));
-
-  __sanitizer_reset_coverage();
-  assert(__sanitizer_get_total_unique_coverage() == 0);
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == 0);
-
-  foo();
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == foo_bit);
-
-  bar();
-  GET_AND_PRINT_COVERAGE();
-  assert(bitset == (foo_bit | bar_bit));
-}




More information about the llvm-commits mailing list