diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4855,7 +4855,7 @@ const std::vector &CmdArgs) { // Save llvm.compiler.used and remove it. SmallVector UsedArray; - SmallPtrSet UsedGlobals; + SmallVector UsedGlobals; Type *UsedElementType = Type::getInt8Ty(M.getContext())->getPointerTo(0); GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true); for (auto *GV : UsedGlobals) { diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -336,7 +336,7 @@ struct ScopedSaveAliaseesAndUsed { Module &M; - SmallPtrSet Used, CompilerUsed; + SmallVector Used, CompilerUsed; std::vector> FunctionAliases; ScopedSaveAliaseesAndUsed(Module &M) : M(M) { @@ -367,9 +367,8 @@ } ~ScopedSaveAliaseesAndUsed() { - appendToUsed(M, std::vector(Used.begin(), Used.end())); - appendToCompilerUsed(M, std::vector(CompilerUsed.begin(), - CompilerUsed.end())); + appendToUsed(M, Used); + appendToCompilerUsed(M, CompilerUsed); for (auto P : FunctionAliases) P.first->setIndirectSymbol(