]> git.eshelyaron.com Git - emacs.git/commit
Constant-propagate variables bound outside loops
authorMattias Engdegård <mattiase@acm.org>
Wed, 22 Sep 2021 09:03:30 +0000 (11:03 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sat, 25 Sep 2021 18:25:02 +0000 (20:25 +0200)
commit8d0ee5e7a9d635a625f87fd8c6eed39a8a749131
tree5cc3aa784cd522ed2ba313192084ec9c00ac81d4
parent32de11d8deff2c4df6d3f8a7b0de8d81980a91e4
Constant-propagate variables bound outside loops

Previously, variables bound outside `while` loops were not substituted
inside even in the absense of mutation.  Add the necessary mutation
checking inside loops to allow propagation of values and aliased
variables.

* lisp/emacs-lisp/byte-opt.el
(byte-optimize--inhibit-outside-loop-constprop): New variable.
(byte-optimize-form-code-walker): First traverse each loop without
substitution to discover mutation, then without restrictions.
* test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-test-loop): New.
(bytecomp-tests--test-cases): Add test cases.
lisp/emacs-lisp/byte-opt.el
test/lisp/emacs-lisp/bytecomp-tests.el