From 37a64c638b7adf835f8512203f7949e22d2d05be Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 24 Apr 2024 00:12:45 +0300 Subject: [PATCH] find-or-chains: look for harmless cleanups. Fixes lp#2063205 --- src/compiler/srctran.lisp | 2 ++ tests/jump-table.pure.lisp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/compiler/srctran.lisp b/src/compiler/srctran.lisp index bf7235088..6c6ab014f 100644 --- a/src/compiler/srctran.lisp +++ b/src/compiler/srctran.lisp @@ -6945,6 +6945,8 @@ (let ((else (next-node (if-alternative if) :type :non-ref :single-predecessor t))) (when (and (combination-p else) + (only-harmless-cleanups (node-block if) + (if-alternative if)) (eq (combination-kind else) :known)) ;; no notinline (let ((op2 (combination-fun-debug-name else)) after-else) diff --git a/tests/jump-table.pure.lisp b/tests/jump-table.pure.lisp index 731300f96..fb84947df 100644 --- a/tests/jump-table.pure.lisp +++ b/tests/jump-table.pure.lisp @@ -135,3 +135,22 @@ (assert (> (sb-kernel:code-jump-table-words (sb-kernel:fun-code-header #'sb-kernel:vector-subseq*)) 20))) + +(with-test (:name :cleanups) + (checked-compile-and-assert + () + `(lambda (b c &optional f) + (block b + (case + (let ((* b)) + (if (eql c 0) + (return-from b (funcall f 11)) + b)) + (t (case c + ((197 97 399) b) + (t 0)))))) + ((33 0 (lambda (x) (+ x *))) 44) + ((1 1) 0) + ((2 197) 2) + ((3 97) 3) + ((4 399) 4))) -- 2.11.4.GIT