[PATCH] D86012: [DFSan] Support fast16labels mode in dfsan_union.
Matt Morehouse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 11:27:54 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG69721fc9d1b5: [DFSan] Support fast16labels mode in dfsan_union. (authored by morehouse).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86012/new/
https://reviews.llvm.org/D86012
Files:
compiler-rt/lib/dfsan/dfsan.cpp
compiler-rt/test/dfsan/custom.cpp
Index: compiler-rt/test/dfsan/custom.cpp
===================================================================
--- compiler-rt/test/dfsan/custom.cpp
+++ compiler-rt/test/dfsan/custom.cpp
@@ -1,5 +1,6 @@
// RUN: %clang_dfsan %s -o %t && DFSAN_OPTIONS="strict_data_dependencies=0" %run %t
// RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t && DFSAN_OPTIONS="strict_data_dependencies=0" %run %t
+// RUN: %clang_dfsan -DFAST_16_LABELS -mllvm -dfsan-fast-16-labels %s -o %t && DFSAN_OPTIONS="strict_data_dependencies=0" %run %t
// RUN: %clang_dfsan -DSTRICT_DATA_DEPENDENCIES %s -o %t && %run %t
// RUN: %clang_dfsan -DSTRICT_DATA_DEPENDENCIES -mllvm -dfsan-args-abi %s -o %t && %run %t
@@ -952,10 +953,19 @@
}
int main(void) {
+#ifdef FAST_16_LABELS
+ i_label = 1;
+ j_label = 2;
+ k_label = 4;
+#else
i_label = dfsan_create_label("i", 0);
j_label = dfsan_create_label("j", 0);
k_label = dfsan_create_label("k", 0);
+#endif
i_j_label = dfsan_union(i_label, j_label);
+ assert(i_j_label != i_label);
+ assert(i_j_label != j_label);
+ assert(i_j_label != k_label);
test_calloc();
test_clock_gettime();
Index: compiler-rt/lib/dfsan/dfsan.cpp
===================================================================
--- compiler-rt/lib/dfsan/dfsan.cpp
+++ compiler-rt/lib/dfsan/dfsan.cpp
@@ -170,6 +170,11 @@
if (l2 == 0)
return l1;
+ // If no labels have been created, yet l1 and l2 are non-zero, we are using
+ // fast16labels mode.
+ if (atomic_load(&__dfsan_last_label, memory_order_relaxed) == 0)
+ return l1 | l2;
+
if (l1 > l2)
Swap(l1, l2);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86012.286099.patch
Type: text/x-patch
Size: 1598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200817/6bd2cd97/attachment.bin>
More information about the llvm-commits
mailing list