]> granicus.if.org Git - llvm/commitdiff
[ASan] Make GlobalsMD member a const reference.
authorLeonard Chan <leonardchan@google.com>
Tue, 1 Oct 2019 20:30:46 +0000 (20:30 +0000)
committerLeonard Chan <leonardchan@google.com>
Tue, 1 Oct 2019 20:30:46 +0000 (20:30 +0000)
PR42924 points out that copying the GlobalsMetadata type during
construction of AddressSanitizer can result in exteremely lengthened
build times for translation units that have many globals. This can be addressed
by just making the GlobalsMD member in AddressSanitizer a reference to
avoid the copy. The GlobalsMetadata type is already passed to the
constructor as a reference anyway.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373389 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/AddressSanitizer.cpp

index 4aea0fd4e73efdb1cdbdd5482380c45ddc38b724..7a46b0777bc1cf866b95f0210f95dfb33026554d 100644 (file)
@@ -692,7 +692,7 @@ private:
   FunctionCallee AsanMemmove, AsanMemcpy, AsanMemset;
   InlineAsm *EmptyAsm;
   Value *LocalDynamicShadow = nullptr;
-  GlobalsMetadata GlobalsMD;
+  const GlobalsMetadata &GlobalsMD;
   DenseMap<const AllocaInst *, bool> ProcessedAllocas;
 };
 
@@ -798,7 +798,7 @@ private:
   }
   int GetAsanVersion(const Module &M) const;
 
-  GlobalsMetadata GlobalsMD;
+  const GlobalsMetadata &GlobalsMD;
   bool CompileKernel;
   bool Recover;
   bool UseGlobalsGC;