]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Merge in changes from my branch r316 that remove redundant operations when building...
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Thu, 22 Oct 2009 13:10:32 +0000 (13:10 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Thu, 22 Oct 2009 13:10:32 +0000 (13:10 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@338 e59a4935-1847-0410-ae03-e826735625c1

src/absrefine_counterexample/CounterExample.cpp

index b4ad3c08c2db6280ca32e4adfca080820a4d892a..83e9b6e7c81f44c96fa63f217c6242f6317c0582 100644 (file)
@@ -439,7 +439,7 @@ namespace BEEV
   Expand_ReadOverWrite_UsingModel(const ASTNode& term, bool arrayread_flag)
   {
     if (READ != term.GetKind() 
-        && WRITE != term[0].GetKind())
+        || WRITE != term[0].GetKind())
       {
         FatalError("RemovesWrites: Input must be a READ over a WRITE", term);
       }
@@ -448,7 +448,7 @@ namespace BEEV
     ASTNodeMap::iterator it1;
     if ((it1 = CounterExampleMap.find(term)) != CounterExampleMap.end())
       {
-        ASTNode val = it1->second;
+        const ASTNode& val = it1->second;
         if (BVCONST != val.GetKind())
           {
             //recursion is fine here. There are two maps that are checked
@@ -468,39 +468,34 @@ namespace BEEV
           }
       }
 
-    unsigned int width = term.GetValueWidth();
-    ASTNode writeA = ASTTrue;
     ASTNode newRead = term;
-    ASTNode readIndex = TermToConstTermUsingModel(newRead[1], false);
+        const ASTNode readIndex = TermToConstTermUsingModel(newRead[1], false);
     //iteratively expand read-over-write, and evaluate against the
     //model at every iteration
+        ASTNode write = newRead[0];
     do
       {
-        ASTNode write = newRead[0];
-        writeA = write[0];
         ASTNode writeIndex = TermToConstTermUsingModel(write[1], false);
-        ASTNode writeVal = TermToConstTermUsingModel(write[2], false);
 
-        ASTNode cond = 
-          ComputeFormulaUsingModel(simp->CreateSimplifiedEQ(writeIndex, 
-                                                            readIndex));
-        if (ASTTrue == cond)
+            if (writeIndex == readIndex)
           {
             //found the write-value. return it
-            output = writeVal;
+                output = TermToConstTermUsingModel(write[2], false);
             CounterExampleMap[term] = output;
             return output;
           }
 
-        newRead = bm->CreateTerm(READ, width, writeA, readIndex);
-      } while (READ == newRead.GetKind() && WRITE == newRead[0].GetKind());
+            write = write[0];
+          } while (WRITE == write.GetKind());
 
+               const unsigned int width = term.GetValueWidth();
+        newRead = bm->CreateTerm(READ, width, write, readIndex);
     output = TermToConstTermUsingModel(newRead, arrayread_flag);
 
     //memoize
     CounterExampleMap[term] = output;
     return output;
-  } //Exand_ReadOverWrite_To_ITE_UsingModel()
+      } //Expand_ReadOverWrite_UsingModel()
 
   /* FUNCTION: accepts a non-constant formula, and checks if the
    * formula is ASTTrue or ASTFalse w.r.t to a model