[PATCH] D84215: [DFSan] Handle fast16labels for all API functions.

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 10:22:31 PDT 2020


kcc added a comment.

I think this is an overkill. 
fast16labels mode should be even simpler: 
there are always 16 primary labels, they don't have any descriptions or properties controlled by dfsan.



================
Comment at: compiler-rt/lib/dfsan/dfsan.cpp:258
+      atomic_fetch_add(&__dfsan_last_label, 1, memory_order_relaxed);
+  if (flags().fast16labels && last_label > 15) {
+    Report(
----------------
I would just err in fast16labels mode w/i checking for last_lavel > 15. 
Users should not call this function at all in fast16labels mode, IMO. 


================
Comment at: compiler-rt/lib/dfsan/dfsan.cpp:321
 const struct dfsan_label_info *dfsan_get_label_info(dfsan_label label) {
+  if (flags().fast16labels && (label & (label - 1))) {
+    // In fast16 mode, we don't have info for any union labels.  Users should
----------------
same


================
Comment at: compiler-rt/lib/dfsan/dfsan.cpp:349
 dfsan_has_label_with_desc(dfsan_label label, const char *desc) {
+  if (flags().fast16labels && (label & (label - 1)) && label != 0) {
+    // This is a union label.  Peel off the lowest bit and recurse.
----------------
same


================
Comment at: compiler-rt/lib/dfsan/dfsan.cpp:378
 
+  if (flags().fast16labels) {
+    for (uptr i = 0; i < last_label; ++i) {
----------------
same


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84215





More information about the llvm-commits mailing list