emacs-diffs
[Top][All Lists]
Advanced

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

master 8e38681: Generate fewer useless conditionals in cl-loop


From: Mattias Engdegård
Subject: master 8e38681: Generate fewer useless conditionals in cl-loop
Date: Sat, 4 Jan 2020 07:27:27 -0500 (EST)

branch: master
commit 8e3868125c902f1864a32d817f34e3dfc4eea9a9
Author: Mattias Engdegård <address@hidden>
Commit: Mattias Engdegård <address@hidden>

    Generate fewer useless conditionals in cl-loop
    
    * 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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index c4f6912..9d0fd15 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -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--"))



reply via email to

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