Changes in directory llvm/include/llvm/Transforms/Utils:

BasicBlockUtils.h updated: 1.10 -> 1.11
---
Log message:

Remove a level of indirection.


---
Diffs of the changes:  (+8 -9)

 BasicBlockUtils.h |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)


Index: llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
diff -u llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.10 
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.11
--- llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h:1.10   Wed Aug 17 
01:34:37 2005
+++ llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h        Fri Feb 10 
15:32:11 2006
@@ -76,20 +76,19 @@
 /// This updates all of the same analyses as the other SplitCriticalEdge
 /// function.
 inline bool SplitCriticalEdge(BasicBlock *Succ, pred_iterator PI, Pass *P = 0) 
{
-  BasicBlock *Pred = *PI;
   bool MadeChange = false;
-  for (succ_iterator SI = succ_begin(Pred), E = succ_end(Pred); SI != E; ++SI)
-    if (*SI == Succ)
-      MadeChange |= SplitCriticalEdge(Pred, SI, P);
+  TerminatorInst *TI = (*PI)->getTerminator();
+  for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
+    if (TI->getSuccessor(i) == Succ)
+      MadeChange |= SplitCriticalEdge(TI, i, P);
   return MadeChange;
 }
 
 inline bool SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst, Pass *P = 0) {
-  for (succ_iterator SI = succ_begin(Src); ; ++SI) {
-    assert(SI != succ_end(Src) && "Edge doesn't exist");
-    if (*SI == Dst)
-      return SplitCriticalEdge(Src, SI, P);
-  }
+  TerminatorInst *TI = Src->getTerminator();
+  for (unsigned i = 0, e = TI->getNumSuccessors(); ; ++i)
+    if (TI->getSuccessor(i) == Dst)
+      return SplitCriticalEdge(TI, i, P);
 }
 } // End llvm namespace
 



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to