]> git.eshelyaron.com Git - emacs.git/commit
Don't compile (+ X 0) as (* X 1)
authorMattias Engdegård <mattiase@acm.org>
Wed, 21 Jun 2023 14:56:12 +0000 (16:56 +0200)
committerMattias Engdegård <mattiase@acm.org>
Wed, 21 Jun 2023 16:00:26 +0000 (18:00 +0200)
commit195ca6b9a37511e2681e75a35781074b16101a42
tree47d04548d7a2ffcc67543382a426c42ae4ae3907
parent6b9510d94f814cacf43793dce76250b5f7e6f64a
Don't compile (+ X 0) as (* X 1)

Previously (+ X 0) was reduced to (+ X) which became (* X 1) in
codegen, but this is wrong for X = -0.0 and also slightly slower.

* lisp/emacs-lisp/byte-opt.el (byte-optimize-plus): Don't reduce an
addition to (+ X) by eliminating zeros; retain one 0 argument.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases):
Add test case.
lisp/emacs-lisp/byte-opt.el
test/lisp/emacs-lisp/bytecomp-tests.el