From c35cfa91a8bbb152095ce3eb3691da481f34ecb1 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. llvm-svn: 175192 --- llvm/include/llvm/Object/ELF.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 00b8af9..bd3bbe1 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/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 -- 2.7.4