Skip to content

Commit c332f3c

Browse files
committed
Fix unsat cache thanks to @blishko
1 parent 6d79cd5 commit c332f3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/EVM/SymExec.hs

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module EVM.SymExec where
55

66
import Control.Concurrent.Async (concurrently, mapConcurrently)
77
import Control.Concurrent.Spawn (parMapIO, pool)
8-
import Control.Concurrent.STM (TVar, readTVarIO, newTVarIO)
8+
import Control.Concurrent.STM (TVar, readTVarIO, newTVarIO, writeTVar, atomically, readTVar)
99
import Control.Monad (when, forM_, forM)
1010
import Control.Monad.IO.Unlift
1111
import Control.Monad.Operational qualified as Operational
@@ -856,7 +856,10 @@ equivalenceCheck' solvers branchesA branchesB create = do
856856
check knownUnsat props = do
857857
ku <- liftIO $ readTVarIO knownUnsat
858858
if subsetAny props ku then pure Qed
859-
else fst <$> checkSatWithProps solvers (Set.toList props)
859+
else do
860+
(ret, _) <- checkSatWithProps solvers (Set.toList props)
861+
when (ret == Qed) $ liftIO $ atomically $ readTVar knownUnsat >>= writeTVar knownUnsat . (props :)
862+
pure ret
860863

861864
-- Allows us to run the queries in parallel. Note that this (seems to) run it
862865
-- from left-to-right, and with a max of K threads. This is in contrast to

0 commit comments

Comments
 (0)