[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

David Greene greened at obbligato.org
Thu Jun 28 19:49:34 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.472 -> 1.473
---
Log message:

Fix reference to cached end iterator invalidated by an erase operation.
Uncovered by _GLIBCXX_DEBUG.


---
Diffs of the changes:  (+3 -1)

 SelectionDAGISel.cpp |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.472 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.473
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.472	Thu Jun 28 18:29:44 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Thu Jun 28 21:49:11 2007
@@ -1700,7 +1700,9 @@
 
   // Merge case into clusters
   if (Cases.size()>=2)
-    for (CaseItr I=Cases.begin(), J=++(Cases.begin()), E=Cases.end(); J!=E; ) {
+    // Cray [dag]: Must recompute end() each iteration because it may
+    // be invalidated by erase if we hold on to it
+    for (CaseItr I=Cases.begin(), J=++(Cases.begin()); J!=Cases.end(); ) {
       int64_t nextValue = cast<ConstantInt>(J->Low)->getSExtValue();
       int64_t currentValue = cast<ConstantInt>(I->High)->getSExtValue();
       MachineBasicBlock* nextBB = J->BB;






More information about the llvm-commits mailing list