Revert "Elide broken but unnecessary if optimisations"

This reverts commit 13aa376e93.

Please don't install anything on the release branch that is
not a clear bugfix for a known bug.
This commit is contained in:
Eli Zaretskii 2022-12-16 19:27:33 +02:00
parent 8e42e20ed7
commit 856d889f3a

View file

@ -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))