[llvm-commits] [llvm] r41139 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp

David Greene greened at obbligato.org
Fri Aug 17 08:13:55 PDT 2007


Author: greened
Date: Fri Aug 17 10:13:55 2007
New Revision: 41139

URL: http://llvm.org/viewvc/llvm-project?rev=41139&view=rev
Log:

Fix GLIBCXX_DEBUG error of comparing two singular iterators


Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp?rev=41139&r1=41138&r2=41139&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Fri Aug 17 10:13:55 2007
@@ -164,12 +164,14 @@
   NodeInfo   *NI;                       // Node info
   NIIterator NGI;                       // Node group iterator
   NIIterator NGE;                       // Node group iterator end
+  bool iter_valid;
 
 public:
   // Ctor.
-  NodeGroupIterator(NodeInfo *N) : NI(N) {
+  NodeGroupIterator(NodeInfo *N) : NI(N), iter_valid(false) {
     // If the node is in a group then set up the group iterator.  Otherwise
     // the group iterators will trip first time out.
+    assert(N && "Bad node info");
     if (N->isInGroup()) {
       // get Group
       NodeGroup *Group = NI->Group;
@@ -177,14 +179,17 @@
       NGE = Group->group_end();
       // Prevent this node from being used (will be in members list
       NI = NULL;
+      iter_valid = true;
     }
   }
 
   /// next - Return the next node info, otherwise NULL.
   ///
   NodeInfo *next() {
-    // If members list
-    if (NGI != NGE) return *NGI++;
+    if (iter_valid) {
+      // If members list
+      if (NGI != NGE) return *NGI++;
+    }
     // Use node as the result (may be NULL)
     NodeInfo *Result = NI;
     // Only use once





More information about the llvm-commits mailing list