[PATCH] D97139: Fix unstable SmallPtrSet iteration issues due to collectUsedGlobalVariables
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 12:34:11 PST 2021
MaskRay updated this revision to Diff 325877.
MaskRay edited the summary of this revision.
MaskRay added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97139/new/
https://reviews.llvm.org/D97139
Files:
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
Index: llvm/lib/Transforms/IPO/LowerTypeTests.cpp
===================================================================
--- llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -336,7 +336,7 @@
struct ScopedSaveAliaseesAndUsed {
Module &M;
- SmallPtrSet<GlobalValue *, 16> Used, CompilerUsed;
+ SmallVector<GlobalValue *, 4> Used, CompilerUsed;
std::vector<std::pair<GlobalIndirectSymbol *, Function *>> FunctionAliases;
ScopedSaveAliaseesAndUsed(Module &M) : M(M) {
@@ -367,9 +367,8 @@
}
~ScopedSaveAliaseesAndUsed() {
- appendToUsed(M, std::vector<GlobalValue *>(Used.begin(), Used.end()));
- appendToCompilerUsed(M, std::vector<GlobalValue *>(CompilerUsed.begin(),
- CompilerUsed.end()));
+ appendToUsed(M, Used);
+ appendToCompilerUsed(M, CompilerUsed);
for (auto P : FunctionAliases)
P.first->setIndirectSymbol(
Index: llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
===================================================================
--- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4855,7 +4855,7 @@
const std::vector<uint8_t> &CmdArgs) {
// Save llvm.compiler.used and remove it.
SmallVector<Constant *, 2> UsedArray;
- SmallPtrSet<GlobalValue *, 4> UsedGlobals;
+ SmallVector<GlobalValue *, 4> UsedGlobals;
Type *UsedElementType = Type::getInt8Ty(M.getContext())->getPointerTo(0);
GlobalVariable *Used = collectUsedGlobalVariables(M, UsedGlobals, true);
for (auto *GV : UsedGlobals) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97139.325877.patch
Type: text/x-patch
Size: 1627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210223/6e449a60/attachment.bin>
More information about the llvm-commits
mailing list