diff options
author | akashlal <unknown> | 2010-12-16 06:09:07 +0000 |
---|---|---|
committer | akashlal <unknown> | 2010-12-16 06:09:07 +0000 |
commit | 8c68d648346f8aa1719f0f12161a36fbd7993454 (patch) | |
tree | 37c595e7a0cea05c99af6b15156a9f9091fded8e /Source/Core/DeadVarElim.cs | |
parent | abd9988c758efb08b17f521b9f2826a0011df1f1 (diff) |
A couple of bug fixes
Diffstat (limited to 'Source/Core/DeadVarElim.cs')
-rw-r--r-- | Source/Core/DeadVarElim.cs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/Source/Core/DeadVarElim.cs b/Source/Core/DeadVarElim.cs index ff097ce8..22a8f160 100644 --- a/Source/Core/DeadVarElim.cs +++ b/Source/Core/DeadVarElim.cs @@ -80,13 +80,22 @@ namespace Microsoft.Boogie { }
foreach (Declaration/*!*/ decl in program.TopLevelDeclarations) {
Contract.Assert(decl != null);
- if (decl is Procedure && !implementedProcs.Contains(cce.NonNull((Procedure)decl))) {
- proc = (Procedure)decl;
- foreach (IdentifierExpr/*!*/ expr in proc.Modifies) {
- Contract.Assert(expr != null);
- ProcessVariable(expr.Decl);
- }
- proc = null;
+ if (decl is Procedure)
+ {
+ if (!implementedProcs.Contains(cce.NonNull((Procedure)decl)))
+ {
+ proc = (Procedure)decl;
+ foreach (IdentifierExpr/*!*/ expr in proc.Modifies)
+ {
+ Contract.Assert(expr != null);
+ ProcessVariable(expr.Decl);
+ }
+ proc = null;
+ }
+ else
+ {
+ modSets.Add(decl as Procedure, new HashSet<Variable>());
+ }
}
}
@@ -162,6 +171,11 @@ namespace Microsoft.Boogie { //Contract.Requires(callCmd != null);
Contract.Ensures(Contract.Result<Cmd>() != null);
Cmd ret = base.VisitCallCmd(callCmd);
+ foreach (IdentifierExpr ie in callCmd.Outs)
+ {
+ if(ie != null) ProcessVariable(ie.Decl);
+ }
+
Procedure callee = callCmd.Proc;
if (callee == null)
return ret;
@@ -170,10 +184,6 @@ namespace Microsoft.Boogie { ProcessVariable(var);
}
}
- foreach (IdentifierExpr ie in callCmd.Outs)
- {
- ProcessVariable(ie.Decl);
- }
return ret;
}
private static void ProcessVariable(Variable var) {
|