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

Chris Lattner lattner at cs.uiuc.edu
Sun Aug 1 02:51:52 PDT 2004



Changes in directory llvm/lib/CodeGen:

BranchFolding.cpp updated: 1.5 -> 1.6

---
Log message:

Dereferencing end() is bad.


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

Index: llvm/lib/CodeGen/BranchFolding.cpp
diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.5 llvm/lib/CodeGen/BranchFolding.cpp:1.6
--- llvm/lib/CodeGen/BranchFolding.cpp:1.5	Sat Jul 31 14:24:41 2004
+++ llvm/lib/CodeGen/BranchFolding.cpp	Sun Aug  1 04:51:42 2004
@@ -96,7 +96,7 @@
 
   // If BB falls through into Old, insert an unconditional branch to New.
   MachineFunction::iterator BBSucc = BB; ++BBSucc;
-  if (&*BBSucc == Old)
+  if (BBSucc != BB->getParent()->end() && &*BBSucc == Old)
     TII.insertGoto(*BB, *New);
 
   std::vector<MachineBasicBlock*> Succs(BB->succ_begin(), BB->succ_end());





More information about the llvm-commits mailing list