[PATCH] D60593: [GwpAsan] Introduce GWP-ASan.

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 18:04:53 PDT 2019


morehouse added inline comments.


================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h:55
+    if (UNLIKELY(SampleRate == 0))
+      return false;
+
----------------
It would be nice to avoid this check on the fast path.

Perhaps we can do `rand() % (SampleRate + 1)` and then check `SampleRate !=0` only just before we would return true.


================
Comment at: compiler-rt/lib/gwp_asan/guarded_pool_allocator.h:59
+    // indirect branch overhead, no matter what the value of the sample
+    // counter.
+    switch (NextSampleCounter) {
----------------
How does the perf compare to a simple `if (NextSampleCounter <= 1)`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60593/new/

https://reviews.llvm.org/D60593





More information about the llvm-commits mailing list