diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp --- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -200,22 +200,20 @@ static void cloneUsedGlobalVariables(const Module &SrcM, Module &DestM, bool CompilerUsed) { SmallPtrSet Used; - SmallPtrSet NewUsed; + SmallVector NewUsed; // First collect those in the llvm[.compiler].used set. collectUsedGlobalVariables(SrcM, Used, CompilerUsed); // Next build a set of the equivalent values defined in DestM. for (auto *V : Used) { auto *GV = DestM.getNamedValue(V->getName()); if (GV && !GV->isDeclaration()) - NewUsed.insert(GV); + NewUsed.push_back(GV); } // Finally, add them to a llvm[.compiler].used variable in DestM. if (CompilerUsed) - appendToCompilerUsed( - DestM, std::vector(NewUsed.begin(), NewUsed.end())); + appendToCompilerUsed(DestM, NewUsed); else - appendToUsed(DestM, - std::vector(NewUsed.begin(), NewUsed.end())); + appendToUsed(DestM, NewUsed); } // If it's possible to split M into regular and thin LTO parts, do so and write