summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-03-25 15:38:00 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-03-25 16:21:09 +0100
commit52b67740d10df8ca539fdc2c7d50283997683141 (patch)
treea7e546ca6ed673ecf5ff46928614185860de0c99
parentdb7e95531ac36ae842787b6c5f2859d0642c78cc (diff)
downloademacs-52b67740d10df8ca539fdc2c7d50283997683141.tar.gz
Generalise a LAP optimisation rule
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Accept (stack-set 1) as equivalent to (discardN-preserve-tos 1) in a rule previously overlooked. This is usually beneficial in code size and almost always shortens dynamic paths.
-rw-r--r--lisp/emacs-lisp/byte-opt.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 3c7aeb89525..0891ec80beb 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -2765,7 +2765,9 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
(or (memq (caar tmp) '(byte-discard byte-discardN))
;; Make sure we don't hoist a discardN-preserve-tos
;; that really should be merged or deleted instead.
- (and (eq (caar tmp) 'byte-discardN-preserve-tos)
+ (and (or (eq (caar tmp) 'byte-discardN-preserve-tos)
+ (and (eq (caar tmp) 'byte-stack-set)
+ (eql (cdar tmp) 1)))
(let ((next (cadr tmp)))
(not (or (memq (car next)
'(byte-discardN-preserve-tos