Add comment.
[oota-llvm.git] / lib / Transforms / Scalar / SimplifyCFG.cpp
index 1d34d316a1d3bb629f6292b0f99edec55500ec5f..5cb2b4086b8af4cf05f3cb78323ff0813cbdb1b4 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -111,7 +111,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
     // canonicalizes unreachable insts into stores to null or undef.
     for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){
       if (CallInst *CI = dyn_cast<CallInst>(BBI)) {
-        if (CI->isNoReturn()) {
+        if (CI->doesNotReturn()) {
           // If we found a call to a no-return function, insert an unreachable
           // instruction after it.  Make sure there isn't *already* one there
           // though.
@@ -135,7 +135,7 @@ static bool MarkAliveBlocks(BasicBlock *BB,
 
     // Turn invokes that call 'nounwind' functions into ordinary calls.
     if (InvokeInst *II = dyn_cast<InvokeInst>(BB->getTerminator()))
-      if (II->isNoUnwind()) {
+      if (II->doesNotThrow()) {
         ChangeToCall(II);
         Changed = true;
       }
@@ -162,13 +162,15 @@ static bool RemoveUnreachableBlocks(Function &F) {
   
   // Loop over all of the basic blocks that are not reachable, dropping all of
   // their internal references...
-  for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB)
-    if (!Reachable.count(BB)) {
-      for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI!=SE; ++SI)
-        if (Reachable.count(*SI))
-          (*SI)->removePredecessor(BB);
-      BB->dropAllReferences();
-    }
+  for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) {
+    if (Reachable.count(BB))
+      continue;
+    
+    for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI)
+      if (Reachable.count(*SI))
+        (*SI)->removePredecessor(BB);
+    BB->dropAllReferences();
+  }
   
   for (Function::iterator I = ++F.begin(); I != F.end();)
     if (!Reachable.count(I))