From e3a6923ecc6f6ca968399765492fe844d2da2f2b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 16 Jun 2009 04:11:20 +0000 Subject: Add basic constant folding / simplification for Eq. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@73467 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Expr/Parser/ConstantFolding.pc | 10 ++++++++++ test/Expr/Parser/Simplify.pc | 7 +++++++ 2 files changed, 17 insertions(+) (limited to 'test/Expr') diff --git a/test/Expr/Parser/ConstantFolding.pc b/test/Expr/Parser/ConstantFolding.pc index bce6d5bb..56895e53 100644 --- a/test/Expr/Parser/ConstantFolding.pc +++ b/test/Expr/Parser/ConstantFolding.pc @@ -180,3 +180,13 @@ array a[64] : w32 -> w8 = symbolic # RUN: grep -A 2 \"# Query 34$\" %t > %t2 # RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 (query [] false [(Xor w8 0 (Read w8 0 a))]) + +# Check -- true == X ==> X +# RUN: grep -A 2 \"# Query 35$\" %t > %t2 +# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +(query [] false [(Eq true (Eq 0 (Read w8 0 a)))]) + +# Check -- !!X ==> X +# RUN: grep -A 2 \"# Query 36$\" %t > %t2 +# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +(query [] false [(Not (Not (Eq 0 (Read w8 0 a))))]) diff --git a/test/Expr/Parser/Simplify.pc b/test/Expr/Parser/Simplify.pc index cf6d90ab..e89d79ff 100644 --- a/test/Expr/Parser/Simplify.pc +++ b/test/Expr/Parser/Simplify.pc @@ -26,3 +26,10 @@ array a[64] : w32 -> w8 = symbolic # RUN: grep -A 2 \"# Query 5\" %t > %t2 # RUN: grep \"(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)\" %t2 (query [] false [(Ne (Read w8 0 a) (Read w8 1 a))]) + +# Check -- !(X or Y) ==> !X and !Y +# RUN: grep -A 3 \"# Query 6$\" %t > %t2 +# RUN: grep \"(query .. false .(And (Not (Eq 0 (Read w8 0 a)))\" %t2 +# RUN: grep \"(Not (Eq 1 (Read w8 1 a))))\" %t2 +(query [] false [(Not (Or (Eq 0 (Read w8 0 a)) + (Eq 1 (Read w8 1 a))))]) -- cgit 1.4.1