]> git.eshelyaron.com Git - emacs.git/commitdiff
Generate fewer useless conditionals in cl-loop
authorMattias Engdegård <mattiase@acm.org>
Sat, 4 Jan 2020 12:14:32 +0000 (13:14 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 4 Jan 2020 12:14:32 +0000 (13:14 +0100)
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause):
Don't generate a condition if both branches are the same, which
is the common case.

lisp/emacs-lisp/cl-macs.el

index c4f69120ff731f96b4db9407a7dcf685dfc3711c..9d0fd15bc3d1c43b55424b05ed9a28c2dff3e309 100644 (file)
@@ -1318,7 +1318,10 @@ For more details, see Info node `(cl)Loop Facility'.
                                                 (nreverse cl--loop-conditions)))
                                          ,then ,var))
                               loop-for-steps))
-                   (push `(,var (if ,first-assign ,start ,then)) loop-for-sets))))
+                    (push (if (eq start then)
+                             `(,var ,then)
+                            `(,var (if ,first-assign ,start ,then)))
+                          loop-for-sets))))
 
               ((memq word '(across across-ref))
                (let ((temp-vec (make-symbol "--cl-vec--"))