diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-30 12:11:58 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-06-30 12:11:58 +0000 |
commit | 1b54221f6865b0daae1b8eb8f84bf5d291e8b864 (patch) | |
tree | 37719daf4fa931324eae1ac31cba9b09867a660c | |
parent | edb883cabf32ef39a3f2ce7a7437894e176a740b (diff) |
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'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74522 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Analysis/LiveVariables.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index b0eb37b065..b354566db0 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -135,9 +135,11 @@ void TransferFuncs::Visit(Stmt *S) { 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) { |