forked from OSchip/llvm-project
[llvm-reduce] Don't reuse SmallVector across calls to getAllMetadata()
The SmallVector is not cleared in calls to getAllMetadata(). Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D113808
This commit is contained in:
parent
cdb0623ad8
commit
0b5051cede
|
@ -36,8 +36,8 @@ static void extractMetadataFromModule(Oracle &O, Module &Program) {
|
|||
}
|
||||
|
||||
// Delete out-of-chunk metadata attached to globals.
|
||||
SmallVector<std::pair<unsigned, MDNode *>> MDs;
|
||||
for (GlobalVariable &GV : Program.globals()) {
|
||||
SmallVector<std::pair<unsigned, MDNode *>> MDs;
|
||||
GV.getAllMetadata(MDs);
|
||||
for (std::pair<unsigned, MDNode *> &MD : MDs)
|
||||
if (!O.shouldKeep())
|
||||
|
@ -45,14 +45,18 @@ static void extractMetadataFromModule(Oracle &O, Module &Program) {
|
|||
}
|
||||
|
||||
for (Function &F : Program) {
|
||||
// Delete out-of-chunk metadata attached to functions.
|
||||
F.getAllMetadata(MDs);
|
||||
for (std::pair<unsigned, MDNode *> &MD : MDs)
|
||||
if (!O.shouldKeep())
|
||||
F.setMetadata(MD.first, NULL);
|
||||
{
|
||||
SmallVector<std::pair<unsigned, MDNode *>> MDs;
|
||||
// Delete out-of-chunk metadata attached to functions.
|
||||
F.getAllMetadata(MDs);
|
||||
for (std::pair<unsigned, MDNode *> &MD : MDs)
|
||||
if (!O.shouldKeep())
|
||||
F.setMetadata(MD.first, NULL);
|
||||
}
|
||||
|
||||
// Delete out-of-chunk metadata attached to instructions.
|
||||
for (Instruction &I : instructions(F)) {
|
||||
SmallVector<std::pair<unsigned, MDNode *>> MDs;
|
||||
I.getAllMetadata(MDs);
|
||||
for (std::pair<unsigned, MDNode *> &MD : MDs)
|
||||
if (!O.shouldKeep())
|
||||
|
|
Loading…
Reference in New Issue