]> git.eshelyaron.com Git - emacs.git/commit
Improved `if` and `while` optimisation
authorMattias Engdegård <mattiase@acm.org>
Fri, 12 Aug 2022 18:12:25 +0000 (20:12 +0200)
committerMattias Engdegård <mattiase@acm.org>
Tue, 16 Aug 2022 18:44:50 +0000 (20:44 +0200)
commite618b6faee5b81d17501fdb2e6b121062f95c021
tree7b9c47a1a008da199e7e361287ecbb021c8c32d8
parent869db699ee276349b5de17b54daa4e75433075b9
Improved `if` and `while` optimisation

Recognise some more special cases:

  (if X nil t)      -> (not X)
  (if X t)          -> (not (not X))
  (if X t nil)      -> (not (not X))
  (if VAR VAR X...) -> (or VAR (progn X...))

* lisp/emacs-lisp/byte-opt.el (byte-opt-negate): New.
(byte-optimize-if): Add transformations above and refactor.
(byte-optimize-while): Better static nil-detection.
lisp/emacs-lisp/byte-opt.el