From ce2f9bd2bc7dd4e070d46114b6a921127bd1ca86 Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Tue, 30 Jun 2009 13:00:53 +0000 Subject: [PATCH] Instead of r74522, use another approach to fix xfail_regionstore_wine_crash.c. Mark the super region of the binding of block level expr in the Environment as live. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74525 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/Environment.cpp | 13 +++++++++++-- lib/Analysis/LiveVariables.cpp | 1 - 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/Analysis/Environment.cpp b/lib/Analysis/Environment.cpp index 2b751df830..1c2802e7fe 100644 --- a/lib/Analysis/Environment.cpp +++ b/lib/Analysis/Environment.cpp @@ -143,8 +143,17 @@ EnvironmentManager::RemoveDeadBindings(Environment Env, Stmt* Loc, SVal X = I.getData(); // If the block expr's value is a memory region, then mark that region. - if (isa(X)) - DRoots.push_back(cast(X).getRegion()); + if (isa(X)) { + const MemRegion* R = cast(X).getRegion(); + DRoots.push_back(R); + // Mark the super region of the RX as live. + // e.g.: int x; char *y = (char*) &x; if (*y) ... + // 'y' => element region. 'x' is its super region. + // We only add one level super region for now. + if (const SubRegion *SR = dyn_cast(R)) { + DRoots.push_back(SR->getSuperRegion()); + } + } // Mark all symbols in the block expr's value live. MarkLiveCallback cb(SymReaper); diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index b354566db0..aead7f43ad 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -138,7 +138,6 @@ void TransferFuncs::Visit(Stmt *S) { else { // For block-level expressions, mark that they are live. LiveState(S,AD) = Alive; - StmtVisitor::Visit(S); } } -- 2.40.0