master: Don't incorrectly lower sublis to :test #'eq

stassats via Sbcl-commits <[email protected]> Tue, 19 May 2026 01:01:24 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  07f82d35917900fe1222891579c2fe9d3d8df3c4 (commit)
      from  93b87fc504b7bb1eaf0ce5c273a59e48605067a2 (commit)

- Log -----------------------------------------------------------------
commit 07f82d35917900fe1222891579c2fe9d3d8df3c4
Author: Stas Boukarev <[email protected]>
Date:   Tue May 19 03:53:58 2026 +0300

    Don't incorrectly lower sublis to :test #'eq
    
    The first argument isn't actually the item it searches for.
---
 src/compiler/seqtran.lisp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp
index fd3ebf23f..7e22b1852 100644
--- a/src/compiler/seqtran.lisp
+++ b/src/compiler/seqtran.lisp
@@ -4281,8 +4281,7 @@
     nil))
 
 (defoptimizers optimizer
-    (remove delete count find position
-     sublis nsublis copy-remove)
+    (remove delete count find position copy-remove)
     ((item sequence &rest args &key
            ((test test-keyword))
            ((test-not test-not-keyword))
@@ -4293,6 +4292,15 @@
       (unless test-not
         (lower-item-test node test item sequence key))))
 
+(defoptimizers optimizer
+    (sublis nsublis)
+    ((item sequence &rest args &key
+           ((test test-keyword))
+           ((test-not test-not-keyword))
+           &allow-other-keys) node)
+  (test-not-complementer test test-keyword test-not test-not-keyword
+                         args))
+
 (defoptimizers optimizer
     (remove-duplicates delete-duplicates
      sb-impl::length-remove-duplicates sb-impl::length-delete-duplicates)

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL