[PATCH] D35958: [sancov] Implement __sanitizer_cov_reset.

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 15:59:00 PDT 2017


kcc added inline comments.


================
Comment at: compiler-rt/include/sanitizer/coverage_interface.h:25
 
-  //  Dump collected coverage info. Sorts pcs by module into individual
-  //  .sancov files.
+  // Clear collected coverage info.
+  void __sanitizer_cov_reset();
----------------
Write something about threads (more that one thread => warranty void)


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc:129
     atomic_uint32_t* guard_ptr = reinterpret_cast<atomic_uint32_t*>(guard);
-    u32 idx = atomic_exchange(guard_ptr, 0, memory_order_relaxed);
+    u32 idx = atomic_load(guard_ptr, memory_order_relaxed);
     if (!idx) return;
----------------
This way you never modify the guard after the initial init, so why not just use a plain load? 


https://reviews.llvm.org/D35958





More information about the llvm-commits mailing list