[llvm] 7d9a2c7 - Remove the NotUnderValgrind caching flag

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 25 17:25:35 PDT 2021


Author: Mehdi Amini
Date: 2021-07-26T00:21:09Z
New Revision: 7d9a2c714c4c198b250b65b955619a169ed9400e

URL: https://github.com/llvm/llvm-project/commit/7d9a2c714c4c198b250b65b955619a169ed9400e
DIFF: https://github.com/llvm/llvm-project/commit/7d9a2c714c4c198b250b65b955619a169ed9400e.diff

LOG: Remove the NotUnderValgrind caching flag

The motivation for this caching wasn't clear, remove it in an effort to
simplify the code and make libSupport free of global dynamic constructor.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D106206

Added: 
    

Modified: 
    llvm/lib/Support/Valgrind.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Valgrind.cpp b/llvm/lib/Support/Valgrind.cpp
index 886cb6ba3311..3cf41faeb55d 100644
--- a/llvm/lib/Support/Valgrind.cpp
+++ b/llvm/lib/Support/Valgrind.cpp
@@ -19,26 +19,11 @@
 #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);
 }
 


        


More information about the llvm-commits mailing list