emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 493fde9: Optimise (cond) => nil at source level


From: Mattias Engdegård
Subject: master 493fde9: Optimise (cond) => nil at source level
Date: Tue, 2 Nov 2021 17:46:58 -0400 (EDT)

branch: master
commit 493fde95bed6c65e049b8e664837397546847b37
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    Optimise (cond) => nil at source level
    
    * lisp/emacs-lisp/byte-opt.el (byte-optimize-cond):
    Optimise clause-free `cond`, which can arise from earlier
    transformations.  This enables further optimisations.
    * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
    Add test cases.
---
 lisp/emacs-lisp/byte-opt.el            | 2 +-
 test/lisp/emacs-lisp/bytecomp-tests.el | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 9b3b2e5..9c64083 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1327,7 +1327,7 @@ See Info node `(elisp) Integer Basics'."
            (list 'or (car (car clauses))
                  (byte-optimize-cond
                   (cons (car form) (cdr (cdr form)))))
-         form))
+         (and clauses form)))
     form))
 
 (defun byte-optimize-if (form)
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index a6e224b..41edc1f 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -640,6 +640,9 @@ inner loops respectively."
            (f (list (lambda (x) (setq a x)))))
       (funcall (car f) 3)
       (list a b))
+
+    (cond)
+    (mapcar (lambda (x) (cond ((= x 0)))) '(0 1))
     )
   "List of expressions for cross-testing interpreted and compiled code.")
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]