master: Don't change :test for subst based on the sequence type

stassats via Sbcl-commits <[email protected]> Wed, 10 Jun 2026 20:18:55 +0000
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  00bf2651cc516d3ecb64323ad1d96c542cfc78b5 (commit)
      from  0298a35f891649f62217f5506d91268e00f48a9b (commit)

- Log -----------------------------------------------------------------
commit 00bf2651cc516d3ecb64323ad1d96c542cfc78b5
Author: Stas Boukarev <[email protected]>
Date:   Wed Jun 10 23:16:41 2026 +0300

    Don't change :test for subst based on the sequence type
    
    It descends multiple levels.
    
    Fixes lp#2156394
---
 src/compiler/seqtran.lisp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/compiler/seqtran.lisp b/src/compiler/seqtran.lisp
index b8dc4f923..a10d3391e 100644
--- a/src/compiler/seqtran.lisp
+++ b/src/compiler/seqtran.lisp
@@ -4443,7 +4443,7 @@
     (lower-one-sequence-test node test sequence key)))
 
 (defoptimizers optimizer
-    (substitute nsubstitute subst nsubst)
+    (substitute nsubstitute)
     ((new old sequence &rest args &key
           ((test test-keyword))
           ((test-not test-not-keyword))
@@ -4455,6 +4455,22 @@
   (unless test-not
     (lower-item-test node test old sequence key)))
 
+(defoptimizers optimizer
+    (subst nsubst)
+    ((new old sequence &rest args &key
+          ((test test-keyword))
+          ((test-not test-not-keyword))
+          key
+          &allow-other-keys)
+     node)
+  (test-not-complementer test test-keyword test-not test-not-keyword
+                         args)
+  (unless test-not
+    (let ((new-test (change-test-lvar-based-on-item test old)))
+      (when new-test
+        (change-keyword-value (find-global-fun new-test t) :test test node))
+      nil)))
+
 (defoptimizers optimizer
     (mismatch search tree-equal
               union intersection

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


hooks/post-receive
-- 
SBCL