forked from OSchip/llvm-project
When processing the transfer function for a statement, evaluate
RemoveDeadBindings early because (1) it will always be called and (2) we can dispatch to a plug-in transfer function that can evaluate the effect of dead symbols (not yet added). llvm-svn: 48114
This commit is contained in:
parent
2d063bef8b
commit
6c50479737
|
@ -39,16 +39,6 @@ using llvm::dyn_cast;
|
|||
using llvm::cast;
|
||||
using llvm::APSInt;
|
||||
|
||||
ValueState* GRExprEngine::RemoveDeadBindings(ValueState* St) {
|
||||
|
||||
if (StateCleaned || !CurrentStmt)
|
||||
return St;
|
||||
|
||||
StateCleaned = true;
|
||||
|
||||
return StateMgr.RemoveDeadBindings(St, CurrentStmt, Liveness);
|
||||
}
|
||||
|
||||
|
||||
ValueState* GRExprEngine::getInitialState() {
|
||||
|
||||
|
@ -420,7 +410,13 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
|
|||
StmtEntryNode = builder.getLastNode();
|
||||
CurrentStmt = S;
|
||||
NodeSet Dst;
|
||||
StateCleaned = false;
|
||||
|
||||
// Create the cleaned state.
|
||||
|
||||
RDBInState = StmtEntryNode->getState();
|
||||
RDBOutState = StateMgr.RemoveDeadBindings(RDBInState, CurrentStmt, Liveness);
|
||||
|
||||
// Visit the statement.
|
||||
|
||||
Visit(S, StmtEntryNode, Dst);
|
||||
|
||||
|
@ -428,10 +424,7 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
|
|||
// dead mappings removed.
|
||||
|
||||
if (Dst.size() == 1 && *Dst.begin() == StmtEntryNode) {
|
||||
ValueState* St =
|
||||
StateCleaned ? StmtEntryNode->getState() :
|
||||
RemoveDeadBindings(StmtEntryNode->getState());
|
||||
|
||||
ValueState* St = RemoveDeadBindings(StmtEntryNode->getState());
|
||||
builder.generateNode(S, St, StmtEntryNode);
|
||||
}
|
||||
|
||||
|
@ -440,6 +433,8 @@ void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
|
|||
CurrentStmt = NULL;
|
||||
StmtEntryNode = NULL;
|
||||
Builder = NULL;
|
||||
RDBInState = NULL;
|
||||
RDBOutState = NULL;
|
||||
}
|
||||
|
||||
void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* D, NodeTy* Pred, NodeSet& Dst){
|
||||
|
|
|
@ -120,7 +120,8 @@ protected:
|
|||
/// where a pass-by-value argument has an undefined value.
|
||||
UndefArgsTy UndefArgs;
|
||||
|
||||
bool StateCleaned;
|
||||
ValueState* RDBInState;
|
||||
ValueState* RDBOutState;
|
||||
|
||||
public:
|
||||
GRExprEngine(GraphTy& g) :
|
||||
|
@ -265,7 +266,10 @@ protected:
|
|||
/// that all subexpression mappings are removed and that any
|
||||
/// block-level expressions that are not live at 'CurrentStmt' also have
|
||||
/// their mappings removed.
|
||||
ValueState* RemoveDeadBindings(ValueState* St);
|
||||
ValueState* RemoveDeadBindings(ValueState* St) {
|
||||
assert (St);
|
||||
return St == RDBInState ? RDBOutState : St;
|
||||
}
|
||||
|
||||
ValueState* SetRVal(ValueState* St, Expr* Ex, RVal V);
|
||||
|
||||
|
|
Loading…
Reference in New Issue