diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-12 18:08:17 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-12 18:08:17 +0000 |
commit | 8e49dd6e7e73b275a74338a5127a524f0765303c (patch) | |
tree | 6c5d8c1c49c477888197eea39fa32f6a29254278 /Analysis/GRConstants.cpp | |
parent | bab96968886f4b77083f4e26a28986ddb1e42d67 (diff) |
Added GRBlockCounter class, which tracks the number of times blocks
have been visited in a path. Added GRBlockCounter as an item to be
enqueued to the worklist.
Modified "ProcessBranch" in GRConstants to prune branches with symbolic
conditions that have been already taken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Analysis/GRConstants.cpp')
-rw-r--r-- | Analysis/GRConstants.cpp | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp index 4ae90770c9..8b94aaa70b 100644 --- a/Analysis/GRConstants.cpp +++ b/Analysis/GRConstants.cpp @@ -375,23 +375,45 @@ void GRConstants::ProcessBranch(Expr* Condition, Stmt* Term, } } - // Process the true branch. - bool isFeasible = true; + // Get the current block counter. + GRBlockCounter BC = builder.getBlockCounter(); + + unsigned NumVisited = BC.getNumVisited(builder.getTargetBlock(true)->getBlockID()); - StateTy St = Assume(PrevState, V, true, isFeasible); + if (isa<nonlval::ConcreteInt>(V) || + BC.getNumVisited(builder.getTargetBlock(true)->getBlockID()) < 1) { + + // Process the true branch. - if (isFeasible) - builder.generateNode(St, true); - else { - builder.markInfeasible(true); - isFeasible = true; + bool isFeasible = true; + + StateTy St = Assume(PrevState, V, true, isFeasible); + + if (isFeasible) + builder.generateNode(St, true); + else + builder.markInfeasible(true); } + else + builder.markInfeasible(true); - // Process the false branch. - St = Assume(PrevState, V, false, isFeasible); + NumVisited = BC.getNumVisited(builder.getTargetBlock(true)->getBlockID()); + - if (isFeasible) - builder.generateNode(St, false); + if (isa<nonlval::ConcreteInt>(V) || + BC.getNumVisited(builder.getTargetBlock(false)->getBlockID()) < 1) { + + // Process the false branch. + + bool isFeasible = false; + + StateTy St = Assume(PrevState, V, false, isFeasible); + + if (isFeasible) + builder.generateNode(St, false); + else + builder.markInfeasible(false); + } else builder.markInfeasible(false); } |