aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/IRSymtab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/IRSymtab.cpp')
-rw-r--r--llvm/lib/Object/IRSymtab.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Object/IRSymtab.cpp b/llvm/lib/Object/IRSymtab.cpp
index 14db7a1..18fc2e4 100644
--- a/llvm/lib/Object/IRSymtab.cpp
+++ b/llvm/lib/Object/IRSymtab.cpp
@@ -215,6 +215,11 @@ Expected<int> Builder::getComdatIndex(const Comdat *C, const Module *M) {
return P.first->second;
}
+static DenseSet<StringRef> buildPreservedSymbolsSet() {
+ return DenseSet<StringRef>(std::begin(PreservedSymbols),
+ std::end(PreservedSymbols));
+}
+
Error Builder::addSymbol(const ModuleSymbolTable &Msymtab,
const SmallPtrSet<GlobalValue *, 4> &Used,
ModuleSymbolTable::Symbol Msym) {
@@ -270,7 +275,9 @@ Error Builder::addSymbol(const ModuleSymbolTable &Msymtab,
setStr(Sym.IRName, GV->getName());
- bool IsPreservedSymbol = llvm::is_contained(PreservedSymbols, GV->getName());
+ static const DenseSet<StringRef> PreservedSymbolsSet =
+ buildPreservedSymbolsSet();
+ bool IsPreservedSymbol = PreservedSymbolsSet.contains(GV->getName());
if (Used.count(GV) || IsPreservedSymbol)
Sym.Flags |= 1 << storage::Symbol::FB_used;