[cfe-commits] r74522 - /cfe/trunk/lib/Analysis/LiveVariables.cpp

Zhongxing Xu xuzhongxing at gmail.com
Tue Jun 30 05:12:19 PDT 2009


Author: zhongxingxu
Date: Tue Jun 30 07:11:58 2009
New Revision: 74522

URL: http://llvm.org/viewvc/llvm-project?rev=74522&view=rev
Log:
Block level expr should be visited. Otherwise variables in init expr of
DeclStmt would be dead before the DeclStmt.
For example:
int x = 0;
int y = x;
'x' would be dead before 'int y = x'.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Tue Jun 30 07:11:58 2009
@@ -135,9 +135,11 @@
     StmtVisitor<TransferFuncs,void>::Visit(S);
     
   }
-  else
+  else {
     // For block-level expressions, mark that they are live.
     LiveState(S,AD) = Alive;
+    StmtVisitor<TransferFuncs,void>::Visit(S);
+  }
 }
   
 void TransferFuncs::VisitTerminator(CFGBlock* B) {





More information about the cfe-commits mailing list