[llvm-commits] CVS: llvm/lib/Target/X86/FloatingPoint.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Feb 14 18:47:01 PST 2004


Changes in directory llvm/lib/Target/X86:

FloatingPoint.cpp updated: 1.22 -> 1.23

---
Log message:

Fix problem in DEBUG code. I could be pointing past the end and
dereferencing it causes an assertion error.


---
Diffs of the changes:  (+14 -14)

Index: llvm/lib/Target/X86/FloatingPoint.cpp
diff -u llvm/lib/Target/X86/FloatingPoint.cpp:1.22 llvm/lib/Target/X86/FloatingPoint.cpp:1.23
--- llvm/lib/Target/X86/FloatingPoint.cpp:1.22	Fri Feb 13 19:18:32 2004
+++ llvm/lib/Target/X86/FloatingPoint.cpp	Sat Feb 14 18:46:41 2004
@@ -245,20 +245,20 @@
     }
     
     // Print out all of the instructions expanded to if -debug
-    DEBUG(if (&*I == PrevMI) {
-            std::cerr<< "Just deleted pseudo instruction\n";
-          } else {
-	    MachineBasicBlock::iterator Start = I;
-	    // Rewind to first instruction newly inserted.
-	    while (Start != BB.begin() &&
-                   --Start != MachineBasicBlock::iterator(PrevMI));
-            ++Start;
-	    std::cerr << "Inserted instructions:\n\t";
-	    Start->print(std::cerr, MF.getTarget());
-	    while (++Start != I); ++Start;
-	  }
-	  dumpStack();
-	  );
+    DEBUG(
+      MachineBasicBlock::iterator PrevI(PrevMI);
+      if (I == PrevI) {
+        std::cerr<< "Just deleted pseudo instruction\n";
+      } else {
+        MachineBasicBlock::iterator Start = I;
+        // Rewind to first instruction newly inserted.
+        while (Start != BB.begin() && prior(Start) != PrevI) --Start;
+        std::cerr << "Inserted instructions:\n\t";
+        Start->print(std::cerr, MF.getTarget());
+        while (++Start != next(I));
+      }
+      dumpStack();
+    );
 
     Changed = true;
   }





More information about the llvm-commits mailing list