From ed02f52d288fb4d8f9049868afa6af84a980cbc3 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Tue, 23 Feb 2021 12:32:08 -0800 Subject: Fix unstable SmallPtrSet iteration issues due to collectUsedGlobalVariables While here, decrease inline element counts from 8 to 4. See D97128 for the choice. Depends on D97128 (which added a new SmallVecImpl overload for collectUsedGlobalVariables). Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D97139 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index c555b67..dd47e220 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -4855,7 +4855,7 @@ void llvm::EmbedBitcodeInModule(llvm::Module &M, llvm::MemoryBufferRef Buf, 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) { -- cgit v1.1