[PATCH] D106206: Remove the NotUnderValgrind caching flag

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 14:26:50 PDT 2021


mehdi_amini updated this revision to Diff 360274.
mehdi_amini retitled this revision from "Lazy initialized the NotUnderValgrind flag" to "Remove the NotUnderValgrind caching flag".
mehdi_amini edited the summary of this revision.
mehdi_amini added a comment.

Remove the "caching" flag entirely for now


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106206

Files:
  llvm/lib/Support/Valgrind.cpp


Index: llvm/lib/Support/Valgrind.cpp
===================================================================
--- llvm/lib/Support/Valgrind.cpp
+++ llvm/lib/Support/Valgrind.cpp
@@ -14,31 +14,17 @@
 
 #include "llvm/Support/Valgrind.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/ManagedStatic.h"
 #include <cstddef>
 
 #if HAVE_VALGRIND_VALGRIND_H
 #include <valgrind/valgrind.h>
 
-static bool InitNotUnderValgrind() {
-  return !RUNNING_ON_VALGRIND;
-}
-
-// This bool is negated from what we'd expect because code may run before it
-// gets initialized.  If that happens, it will appear to be 0 (false), and we
-// want that to cause the rest of the code in this file to run the
-// Valgrind-provided macros.
-static const bool NotUnderValgrind = InitNotUnderValgrind();
-
 bool llvm::sys::RunningOnValgrind() {
-  if (NotUnderValgrind)
-    return false;
   return RUNNING_ON_VALGRIND;
 }
 
 void llvm::sys::ValgrindDiscardTranslations(const void *Addr, size_t Len) {
-  if (NotUnderValgrind)
-    return;
-
   VALGRIND_DISCARD_TRANSLATIONS(Addr, Len);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106206.360274.patch
Type: text/x-patch
Size: 1071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210720/40c6f60f/attachment.bin>


More information about the llvm-commits mailing list