[cfe-commits] r46153 - /cfe/trunk/Analysis/LiveVariables.cpp

Ted Kremenek kremenek at apple.com
Thu Jan 17 16:40:21 PST 2008


Author: kremenek
Date: Thu Jan 17 18:40:21 2008
New Revision: 46153

URL: http://llvm.org/viewvc/llvm-project?rev=46153&view=rev
Log:
Fixed bug in 'LiveVariables' analysis where we incorrectly marked a variable
dead at an assignment without taking into account if the variable was used in
the RHS of the assignment.

Modified:
    cfe/trunk/Analysis/LiveVariables.cpp

Modified: cfe/trunk/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/LiveVariables.cpp?rev=46153&r1=46152&r2=46153&view=diff

==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Thu Jan 17 18:40:21 2008
@@ -77,10 +77,9 @@
   if (AD.Observer)
     AD.Observer->ObserveStmt(S,AD,LiveState);
   
-
   if (S == getCurrentBlkStmt()) {
-    StmtVisitor<TransferFuncs,void>::Visit(S);
     if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead;
+    StmtVisitor<TransferFuncs,void>::Visit(S);
   }
   else if (!getCFG().isBlkExpr(S))
     StmtVisitor<TransferFuncs,void>::Visit(S);
@@ -199,6 +198,10 @@
   return getStmtData(Loc)(StmtVal,getAnalysisData());
 }
 
+bool LiveVariables::isLive(const Stmt* Loc, const VarDecl* D) const {
+  return getStmtData(Loc)(D,getAnalysisData());
+}
+
 //===----------------------------------------------------------------------===//
 // printing liveness state for debugging
 //





More information about the cfe-commits mailing list