]> git.eshelyaron.com Git - emacs.git/commit
'assoc' is not side-effect-free; constprop its pure subset
authorMattias Engdegård <mattiase@acm.org>
Sat, 31 Oct 2020 13:16:25 +0000 (14:16 +0100)
committerMattias Engdegård <mattiase@acm.org>
Sat, 31 Oct 2020 13:31:43 +0000 (14:31 +0100)
commit0cbcc6223a75fee4af9211107ed392cb987c0a91
tree6340c9eace70a0957d1e0ee97b3289dc504a2f3b
parent8d72075aeb58e3b8eb91c78c4f51076d12d22263
'assoc' is not side-effect-free; constprop its pure subset

Since a supplied test function can do anything, assoc is not
side-effect-free (bug#44018).  However, with only two arguments it is
pure and should be optimised accordingly.

* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Remove 'assoc'.
(byte-optimize-assoc): Constant-propagate through 2-arg assoc calls.
* test/lisp/emacs-lisp/bytecomp-tests.el
(byte-opt-testsuite-arith-data): Add test cases.
lisp/emacs-lisp/byte-opt.el
test/lisp/emacs-lisp/bytecomp-tests.el