From 1b54221f6865b0daae1b8eb8f84bf5d291e8b864 Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Tue, 30 Jun 2009 12:11:58 +0000 Subject: [PATCH] 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 --- lib/Analysis/LiveVariables.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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::Visit(S); } - else + else { // For block-level expressions, mark that they are live. LiveState(S,AD) = Alive; + StmtVisitor::Visit(S); + } } void TransferFuncs::VisitTerminator(CFGBlock* B) { -- 2.40.0