aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2013-02-14 18:41:42 +0000
committerDmitry Vyukov <dvyukov@google.com>2013-02-14 18:41:42 +0000
commit06121de923cb7e8e2ea3cf527f281d9e7825e518 (patch)
treece42c5e9dfc984e6e6500d30109c7349a2362adc
parent6cc4b8d1eb2adf547807044e0a97f3a255733784 (diff)
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
-rw-r--r--include/llvm/Object/ELF.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h
index 00b8af949f..bd3bbe1e4f 100644
--- a/include/llvm/Object/ELF.h
+++ b/include/llvm/Object/ELF.h
@@ -867,6 +867,7 @@ void ELFObjectFile<ELFT>::LoadVersionMap() const {
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(DataRefImpl Symb) const {
+ SymbolTableSection->sh_size)))
// FIXME: Proper error handling.
report_fatal_error("Symb must point to a valid symbol!");
+#endif
}
template<class ELFT>