[llvm] 453a63c - [NFC][HWASAN] Promote InstrumentGlobals to member (#86773)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 13:38:25 PDT 2024


Author: Vitaly Buka
Date: 2024-03-27T13:38:21-07:00
New Revision: 453a63caebc35378bcdb31da9d0f358a3998e51b

URL: https://github.com/llvm/llvm-project/commit/453a63caebc35378bcdb31da9d0f358a3998e51b
DIFF: https://github.com/llvm/llvm-project/commit/453a63caebc35378bcdb31da9d0f358a3998e51b.diff

LOG: [NFC][HWASAN] Promote InstrumentGlobals to member (#86773)

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 5d366e3d6dee0a..96fd530be33318 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -422,6 +422,7 @@ class HWAddressSanitizer {
   bool InstrumentLandingPads;
   bool InstrumentWithCalls;
   bool InstrumentStack;
+  bool InstrumentGlobals;
   bool DetectUseAfterScope;
   bool UsePageAliases;
   bool UseMatchAllCallback;
@@ -639,11 +640,13 @@ void HWAddressSanitizer::initializeModule() {
   // If we don't have personality function support, fall back to landing pads.
   InstrumentLandingPads = optOr(ClInstrumentLandingPads, !NewRuntime);
 
+  InstrumentGlobals =
+      !CompileKernel && !UsePageAliases && optOr(ClGlobals, NewRuntime);
+
   if (!CompileKernel) {
     createHwasanCtorComdat();
-    bool InstrumentGlobals = optOr(ClGlobals, NewRuntime);
 
-    if (InstrumentGlobals && !UsePageAliases)
+    if (InstrumentGlobals)
       instrumentGlobals();
 
     bool InstrumentPersonalityFunctions =


        


More information about the llvm-commits mailing list