[llvm-commits] CVS: llvm/lib/Transforms/IPO/ConstantMerge.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 14 11:07:14 PDT 2007
Changes in directory llvm/lib/Transforms/IPO:
ConstantMerge.cpp updated: 1.38 -> 1.39
---
Log message:
avoid iterator invalidation.
---
Diffs of the changes: (+4 -2)
ConstantMerge.cpp | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/IPO/ConstantMerge.cpp
diff -u llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.38 llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.39
--- llvm/lib/Transforms/IPO/ConstantMerge.cpp:1.38 Sat Apr 14 12:18:29 2007
+++ llvm/lib/Transforms/IPO/ConstantMerge.cpp Sat Apr 14 13:06:52 2007
@@ -60,8 +60,10 @@
// 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()) {
More information about the llvm-commits
mailing list