mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
avoid iterator invalidation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36002 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
70718366d9
commit
ae143ceb83
@ -60,8 +60,10 @@ bool ConstantMerge::runOnModule(Module &M) {
|
||||
// because doing so may cause initializers of other globals to be rewritten,
|
||||
// invalidating the Constant* pointers in CMap.
|
||||
//
|
||||
for (Module::global_iterator GV = M.global_begin(), E = M.global_end();
|
||||
GV != E; ++GV) {
|
||||
for (Module::global_iterator GVI = M.global_begin(), E = M.global_end();
|
||||
GVI != E; ) {
|
||||
GlobalVariable *GV = GVI++;
|
||||
|
||||
// If this GV is dead, remove it.
|
||||
GV->removeDeadConstantUsers();
|
||||
if (GV->use_empty() && GV->hasInternalLinkage()) {
|
||||
|
Loading…
Reference in New Issue
Block a user