Skip to content

Commit 0fe55a5

Browse files
committed
change 2 for loops to 1
1 parent d063024 commit 0fe55a5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

llvm/lib/Target/DirectX/DXILFinalizeLinkage.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ static bool finalizeLinkage(Module &M) {
2929
}
3030

3131
// Remove unused global variables.
32-
SmallVector<GlobalVariable *> ToErase;
33-
for (GlobalVariable &GV : M.globals()) {
32+
for (GlobalVariable &GV : make_early_inc_range(M.globals())) {
3433
if (GV.use_empty()) {
35-
ToErase.push_back(&GV);
34+
GV.eraseFromParent();
35+
MadeChange = true;
3636
}
3737
}
38-
for (GlobalVariable *GV : ToErase) {
39-
GV->eraseFromParent();
40-
MadeChange = true;
41-
}
4238

4339
SmallVector<Function *> Funcs;
4440

0 commit comments

Comments
 (0)