[PATCH] D81239: Correctly report modified status for DataFlowSanitizer

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 07:06:00 PDT 2020


serge-sans-paille updated this revision to Diff 269528.

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

https://reviews.llvm.org/D81239

Files:
  llvm/include/llvm/IR/Module.h
  llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp


Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -811,6 +811,7 @@
   if (ABIList.isIn(M, "skip"))
     return false;
 
+  const unsigned InitialGlobalSize = M.global_size();
   if (!GetArgTLSPtr) {
     Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
     ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
@@ -1044,7 +1045,7 @@
     }
   }
 
-  return false;
+  return !FnsToInstrument.empty() && M.global_size() != InitialGlobalSize;
 }
 
 Value *DFSanFunction::getArgTLSPtr() {
Index: llvm/include/llvm/IR/Module.h
===================================================================
--- llvm/include/llvm/IR/Module.h
+++ llvm/include/llvm/IR/Module.h
@@ -593,6 +593,7 @@
   const_global_iterator global_begin() const { return GlobalList.begin(); }
   global_iterator       global_end  ()       { return GlobalList.end(); }
   const_global_iterator global_end  () const { return GlobalList.end(); }
+  size_t                global_size () const { return GlobalList.size(); }
   bool                  global_empty() const { return GlobalList.empty(); }
 
   iterator_range<global_iterator> globals() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81239.269528.patch
Type: text/x-patch
Size: 1324 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200609/251a76e0/attachment.bin>


More information about the llvm-commits mailing list