emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 856d889f3a: Revert "Elide broken but unnecessary `if` optimisat


From: Eli Zaretskii
Subject: emacs-29 856d889f3a: Revert "Elide broken but unnecessary `if` optimisations"
Date: Fri, 16 Dec 2022 12:28:26 -0500 (EST)

branch: emacs-29
commit 856d889f3a87cd6a45c52db2adc6b1a4fdc9295a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Revert "Elide broken but unnecessary `if` optimisations"
    
    This reverts commit 13aa376e93564a8cf2ddbbcf0968c6666620db89.
    
    Please don't install anything on the release branch that is
    not a clear bugfix for a known bug.
---
 lisp/emacs-lisp/byte-opt.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 0da2a9b882..a7e1df3622 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1297,8 +1297,11 @@ See Info node `(elisp) Integer Basics'."
       (if else
           `(progn ,condition ,@else)
         condition))
-     ;; (if X t) -> (not (not X))
-     ((and (eq then t) (null else))
+     ;; (if X nil t) -> (not X)
+     ((and (eq then nil) (eq else '(t)))
+      `(not ,condition))
+     ;; (if X t [nil]) -> (not (not X))
+     ((and (eq then t) (or (null else) (eq else '(nil))))
       `(not ,(byte-opt--negate condition)))
      ;; (if VAR VAR X...) -> (or VAR (progn X...))
      ((and (symbolp condition) (eq condition then))



reply via email to

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