[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp 672988e 5/9: Symplify (not t) => nil and (not nil) =
From: |
Andrea Corallo |
Subject: |
feature/native-comp 672988e 5/9: Symplify (not t) => nil and (not nil) => t |
Date: |
Thu, 24 Dec 2020 09:49:31 -0500 (EST) |
branch: feature/native-comp
commit 672988e961744750d3ea40904807355336116c3f
Author: Andrea Corallo <akrl@sdf.org>
Commit: Andrea Corallo <akrl@sdf.org>
Symplify (not t) => nil and (not nil) => t
* lisp/emacs-lisp/comp-cstr.el (comp-cstr-negation): Symplify (not
t) => nil and (not nil) => t.
* test/lisp/emacs-lisp/comp-cstr-tests.el
(comp-cstr-typespec-tests-alist): Add two tests.
---
lisp/emacs-lisp/comp-cstr.el | 25 +++++++++++++++++++++----
test/lisp/emacs-lisp/comp-cstr-tests.el | 6 +++++-
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 8b5639c..1990595 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -695,10 +695,27 @@ DST is returned."
"Negate SRC setting the result in DST.
DST is returned."
(with-comp-cstr-accessors
- (setf (typeset dst) (typeset src)
- (valset dst) (valset src)
- (range dst) (range src)
- (neg dst) (not (neg src)))
+ (cond
+ ((and (null (valset src))
+ (null (range src))
+ (null (neg src))
+ (equal (typeset src) '(t)))
+ (setf (typeset dst) ()
+ (valset dst) ()
+ (range dst) nil
+ (neg dst) nil))
+ ((and (null (valset src))
+ (null (range src))
+ (null (neg src))
+ (null (typeset src)))
+ (setf (typeset dst) '(t)
+ (valset dst) ()
+ (range dst) nil
+ (neg dst) nil))
+ (t (setf (typeset dst) (typeset src)
+ (valset dst) (valset src)
+ (range dst) (range src)
+ (neg dst) (not (neg src)))))
dst))
(defun comp-cstr-value-negation (dst src)
diff --git a/test/lisp/emacs-lisp/comp-cstr-tests.el
b/test/lisp/emacs-lisp/comp-cstr-tests.el
index 834f440..1e1376b 100644
--- a/test/lisp/emacs-lisp/comp-cstr-tests.el
+++ b/test/lisp/emacs-lisp/comp-cstr-tests.el
@@ -203,7 +203,11 @@
;; 81
((and t (not t)) . nil)
;; 82
- ((or (integer 1 1) (not (integer 1 1))) . t))
+ ((or (integer 1 1) (not (integer 1 1))) . t)
+ ;; 83
+ ((not t) . nil)
+ ;; 84
+ ((not nil) . t))
"Alist type specifier -> expected type specifier."))
(defmacro comp-cstr-synthesize-tests ()
- feature/native-comp updated (b99a474 -> b4ee13c), Andrea Corallo, 2020/12/24
- feature/native-comp 4deeb2f 1/9: Invert basic block argument order in LIMPLE cond-jump, Andrea Corallo, 2020/12/24
- feature/native-comp c07c9f6 2/9: Extend cstrs pass to match `when' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 538f598 4/9: Extend cstrs pass to match `unless' like code, Andrea Corallo, 2020/12/24
- feature/native-comp 672988e 5/9: Symplify (not t) => nil and (not nil) => t,
Andrea Corallo <=
- feature/native-comp 96d4c70 6/9: * Fix logic for constraining block with multiple predecessors, Andrea Corallo, 2020/12/24
- feature/native-comp 715cac1 3/9: * lisp/emacs-lisp/comp.el (comp-limplify-lap-inst): Opencode byte-not., Andrea Corallo, 2020/12/24
- feature/native-comp 2327a98 8/9: * Constrain only mvars that are actually used, Andrea Corallo, 2020/12/24
- feature/native-comp b4ee13c 9/9: * Memoize `comp-subtype-p', Andrea Corallo, 2020/12/24
- feature/native-comp 2a6c6bf 7/9: * Use `comp-assign-op-p' into dead code elimination pass, Andrea Corallo, 2020/12/24