r204004 - Remove dead functions from unreachable code analysis.

Benjamin Kramer benny.kra at googlemail.com
Sat Mar 15 03:20:49 PDT 2014


Author: d0k
Date: Sat Mar 15 05:20:49 2014
New Revision: 204004

URL: http://llvm.org/viewvc/llvm-project?rev=204004&view=rev
Log:
Remove dead functions from unreachable code analysis.

Modified:
    cfe/trunk/lib/Analysis/ReachableCode.cpp

Modified: cfe/trunk/lib/Analysis/ReachableCode.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ReachableCode.cpp?rev=204004&r1=204003&r2=204004&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ReachableCode.cpp (original)
+++ cfe/trunk/lib/Analysis/ReachableCode.cpp Sat Mar 15 05:20:49 2014
@@ -30,50 +30,6 @@ using namespace clang;
 // Core Reachability Analysis routines.
 //===----------------------------------------------------------------------===//
 
-static bool bodyEndsWithNoReturn(const CFGBlock *B) {
-  for (CFGBlock::const_reverse_iterator I = B->rbegin(), E = B->rend();
-       I != E; ++I) {
-    if (Optional<CFGStmt> CS = I->getAs<CFGStmt>()) {
-      const Stmt *S = CS->getStmt();
-      if (const ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(S))
-        S = EWC->getSubExpr();
-      if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
-        QualType CalleeType = CE->getCallee()->getType();
-        if (getFunctionExtInfo(*CalleeType).getNoReturn())
-          return true;
-      }
-      break;
-    }
-  }
-  return false;
-}
-
-static bool bodyEndsWithNoReturn(const CFGBlock::AdjacentBlock &AB) {
-  // If the predecessor is a normal CFG edge, then by definition
-  // the predecessor did not end with a 'noreturn'.
-  if (AB.getReachableBlock())
-    return false;
-
-  const CFGBlock *Pred = AB.getPossiblyUnreachableBlock();
-  assert(!AB.isReachable() && Pred);
-  return bodyEndsWithNoReturn(Pred);
-}
-
-static bool isBreakPrecededByNoReturn(const CFGBlock *B, const Stmt *S,
-                                      reachable_code::UnreachableKind &UK) {
-  if (!isa<BreakStmt>(S))
-    return false;
-
-  UK = reachable_code::UK_Break;
-
-  if (B->pred_empty())
-    return false;
-
-  assert(B->empty());
-  assert(B->pred_size() == 1);
-  return bodyEndsWithNoReturn(*B->pred_begin());
-}
-
 static bool isEnumConstant(const Expr *Ex) {
   const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Ex);
   if (!DR)





More information about the cfe-commits mailing list