From 06121de923cb7e8e2ea3cf527f281d9e7825e518 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Feb 2013 18:41:42 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175192 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELF.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index 00b8af949f8..bd3bbe1e4fa 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -867,6 +867,7 @@ void ELFObjectFile::LoadVersionMap() const { template void ELFObjectFile::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::validateSymbol(DataRefImpl Symb) const { + SymbolTableSection->sh_size))) // FIXME: Proper error handling. report_fatal_error("Symb must point to a valid symbol!"); +#endif } template