diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-07-03 22:25:27 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-07-03 22:25:27 +0000 |
commit | 03648657c7327175f0e6349fb7a83115a0562d9d (patch) | |
tree | b221d7b8540c95996227626d5f0ed217d34c0969 /lib/Analysis/LiveVariables.cpp | |
parent | 1c6f3b274cdbe75c575eaba9e3d151a96131b91f (diff) |
Fix a bug in the dead stores checker reported in the following email:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html
Essentially the observer mechanism in LiveVariables was observing block-level
expressions multiple times, leading to a case where the dead store checker could
see a value as dead when it was really live.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53115 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LiveVariables.cpp')
-rw-r--r-- | lib/Analysis/LiveVariables.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Analysis/LiveVariables.cpp b/lib/Analysis/LiveVariables.cpp index 54e2195a77..8f391dc561 100644 --- a/lib/Analysis/LiveVariables.cpp +++ b/lib/Analysis/LiveVariables.cpp @@ -133,15 +133,23 @@ public: }; void TransferFuncs::Visit(Stmt *S) { - if (AD.Observer) - AD.Observer->ObserveStmt(S,AD,LiveState); if (S == getCurrentBlkStmt()) { + + if (AD.Observer) + AD.Observer->ObserveStmt(S,AD,LiveState); + if (getCFG().isBlkExpr(S)) LiveState(S,AD) = Dead; StmtVisitor<TransferFuncs,void>::Visit(S); } - else if (!getCFG().isBlkExpr(S)) + else if (!getCFG().isBlkExpr(S)) { + + if (AD.Observer) + AD.Observer->ObserveStmt(S,AD,LiveState); + StmtVisitor<TransferFuncs,void>::Visit(S); + + } else // For block-level expressions, mark that they are live. LiveState(S,AD) = Alive; |