[llvm] r175192 - include/llvm/Object/ELF.h: do debug checks only when NDEBUG

Dmitry Vyukov dvyukov at google.com
Thu Feb 14 10:41:42 PST 2013


Author: dvyukov
Date: Thu Feb 14 12:41:42 2013
New Revision: 175192

URL: http://llvm.org/viewvc/llvm-project?rev=175192&view=rev
Log:
include/llvm/Object/ELF.h: do debug checks only when NDEBUG
validateSymbol() is called all over the place, and it seems it's a debug check.
It significantly speedups llvm-symbolizer used in tsan/asan/msan. validateSymbol() is the second hot function and accounts for 15% of runtime.

Modified:
    llvm/trunk/include/llvm/Object/ELF.h

Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=175192&r1=175191&r2=175192&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Thu Feb 14 12:41:42 2013
@@ -867,6 +867,7 @@ void ELFObjectFile<ELFT>::LoadVersionMap
 
 template<class ELFT>
 void ELFObjectFile<ELFT>::validateSymbol(DataRefImpl Symb) const {
+#ifndef NDEBUG
   const Elf_Sym  *symb = getSymbol(Symb);
   const Elf_Shdr *SymbolTableSection = SymbolTableSections[Symb.d.b];
   // FIXME: We really need to do proper error handling in the case of an invalid
@@ -881,6 +882,7 @@ void ELFObjectFile<ELFT>::validateSymbol
                    + SymbolTableSection->sh_size)))
     // FIXME: Proper error handling.
     report_fatal_error("Symb must point to a valid symbol!");
+#endif
 }
 
 template<class ELFT>





More information about the llvm-commits mailing list